Merge remote-tracking branch 'parent/main' into kbtopic-remove-quote
This commit is contained in:
commit
80542ea172
76 changed files with 658 additions and 390 deletions
|
@ -6,6 +6,7 @@ class REST::TagSerializer < ActiveModel::Serializer
|
|||
attributes :id, :name, :url, :history
|
||||
|
||||
attribute :following, if: :current_user?
|
||||
attribute :featuring, if: :current_user?
|
||||
|
||||
def id
|
||||
object.id.to_s
|
||||
|
@ -27,6 +28,14 @@ class REST::TagSerializer < ActiveModel::Serializer
|
|||
end
|
||||
end
|
||||
|
||||
def featuring
|
||||
if instance_options && instance_options[:relationships]
|
||||
instance_options[:relationships].featuring_map[object.id] || false
|
||||
else
|
||||
FeaturedTag.exists?(tag_id: object.id, account_id: current_user.account_id)
|
||||
end
|
||||
end
|
||||
|
||||
def current_user?
|
||||
!current_user.nil?
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue