mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2025-01-07 21:46:56 +01:00
Revert "Temporarily undo tag_serializer changes due to an error"
This reverts commit dc03059a7b
.
This commit is contained in:
parent
dc03059a7b
commit
92268f5da7
1 changed files with 14 additions and 0 deletions
|
@ -5,6 +5,8 @@ class REST::TagSerializer < ActiveModel::Serializer
|
||||||
|
|
||||||
attributes :name, :url, :history
|
attributes :name, :url, :history
|
||||||
|
|
||||||
|
attribute :following, if: :current_user?
|
||||||
|
|
||||||
def url
|
def url
|
||||||
tag_url(object)
|
tag_url(object)
|
||||||
end
|
end
|
||||||
|
@ -12,4 +14,16 @@ class REST::TagSerializer < ActiveModel::Serializer
|
||||||
def name
|
def name
|
||||||
object.display_name
|
object.display_name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def following
|
||||||
|
if instance_options && instance_options[:relationships]
|
||||||
|
instance_options[:relationships].following_map[object.id] || false
|
||||||
|
else
|
||||||
|
TagFollow.where(tag_id: object.id, account_id: current_user.account_id).exists?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def current_user?
|
||||||
|
!current_user.nil?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue