2020-09-02 00:11:12 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ActivityPub::HashtagSerializer < ActivityPub::Serializer
|
|
|
|
include RoutingHelper
|
|
|
|
|
|
|
|
attributes :type, :href, :name
|
|
|
|
|
|
|
|
def type
|
|
|
|
'Hashtag'
|
|
|
|
end
|
|
|
|
|
|
|
|
def name
|
2022-07-13 13:03:28 +00:00
|
|
|
"##{object.display_name}"
|
2020-09-02 00:11:12 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def href
|
2022-07-13 13:03:28 +00:00
|
|
|
if object.instance_of?(FeaturedTag)
|
2020-09-02 00:11:12 +00:00
|
|
|
short_account_tag_url(object.account, object.tag)
|
|
|
|
else
|
|
|
|
tag_url(object)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|