Skip to content

Commit

Permalink
fix: hide tags field on community license (#1806)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Bob committed Jun 28, 2023
1 parent 3334570 commit a45a460
Show file tree
Hide file tree
Showing 3 changed files with 241 additions and 241 deletions.
16 changes: 1 addition & 15 deletions lib/avo/concerns/has_fields.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,23 +168,9 @@ def get_field_definitions(only_root: false)

return [] if fields.blank?

items = fields.map do |field|
fields.map do |field|
field.hydrate(resource: self, user: user, view: view)
end

if Avo::App.license.lacks_with_trial(:custom_fields)
items = items.reject do |field|
field.custom?
end
end

if Avo::App.license.lacks_with_trial(:advanced_fields)
items = items.reject do |field|
field.type == "tags"
end
end

items
end

def get_fields(panel: nil, reflection: nil, only_root: false)
Expand Down
16 changes: 15 additions & 1 deletion lib/avo/items_holder.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
module Avo
class ItemsHolder
attr_reader :tools
attr_accessor :items
attr_writer :items
attr_accessor :invalid_fields

def items
items = @items

if Avo::App.license.lacks_with_trial(:custom_fields)
items.reject! { |item| item.is_field? && item.custom? }
end

if Avo::App.license.lacks_with_trial(:advanced_fields)
items.reject! { |item| item.is_field? && item.type == "tags" }
end

items
end

def initialize
@items = []
@items_index = 0
Expand Down
Loading

0 comments on commit a45a460

Please sign in to comment.