about summary refs log tree commit diff
path: root/app/serializers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-12-13 05:22:01 +0100
committerGitHub <noreply@github.com>2018-12-13 05:22:01 +0100
commit6d2080a74b58578de803a43ca381f5791231b873 (patch)
treee992914286fc3ed98b1b59bca9284803ea1e58f8 /app/serializers
parent426d7191d9301360fa82c17195092246b1eb0c45 (diff)
Add account hashtags to ActivityPub actor JSON (#9450)
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/activitypub/actor_serializer.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb
index 5054bd683..72c30dc73 100644
--- a/app/serializers/activitypub/actor_serializer.rb
+++ b/app/serializers/activitypub/actor_serializer.rb
@@ -105,7 +105,7 @@ class ActivityPub::ActorSerializer < ActiveModel::Serializer
   end
 
   def virtual_tags
-    object.emojis
+    object.emojis + object.tags
   end
 
   def virtual_attachments
@@ -119,6 +119,24 @@ class ActivityPub::ActorSerializer < ActiveModel::Serializer
   class CustomEmojiSerializer < ActivityPub::EmojiSerializer
   end
 
+  class TagSerializer < ActiveModel::Serializer
+    include RoutingHelper
+
+    attributes :type, :href, :name
+
+    def type
+      'Hashtag'
+    end
+
+    def href
+      explore_hashtag_url(object)
+    end
+
+    def name
+      "##{object.name}"
+    end
+  end
+
   class Account::FieldSerializer < ActiveModel::Serializer
     attributes :type, :name, :value