Skip to content

Commit 903c13c

Browse files
Gargronhiyuki2578
authored andcommitted
Add account hashtags to ActivityPub actor JSON (mastodon#9450)
1 parent 2d7b883 commit 903c13c

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

app/serializers/activitypub/actor_serializer.rb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def is_cat
109109
end
110110

111111
def virtual_tags
112-
object.emojis
112+
object.emojis + object.tags
113113
end
114114

115115
def virtual_attachments
@@ -123,6 +123,24 @@ def moved_to
123123
class CustomEmojiSerializer < ActivityPub::EmojiSerializer
124124
end
125125

126+
class TagSerializer < ActiveModel::Serializer
127+
include RoutingHelper
128+
129+
attributes :type, :href, :name
130+
131+
def type
132+
'Hashtag'
133+
end
134+
135+
def href
136+
explore_hashtag_url(object)
137+
end
138+
139+
def name
140+
"##{object.name}"
141+
end
142+
end
143+
126144
class Account::FieldSerializer < ActiveModel::Serializer
127145
attributes :type, :name, :value
128146

0 commit comments

Comments
 (0)