about summary refs log tree commit diff
path: root/app/serializers/rest/account_featured_tag_serializer.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-09-07 14:16:54 +0200
committerGitHub <noreply@github.com>2020-09-07 14:16:54 +0200
commit437d71bddf967573df3912ee5976f7c5a5a7b4c7 (patch)
tree322231d7d50704edf8da762b69ee22c9850f2ce3 /app/serializers/rest/account_featured_tag_serializer.rb
parentd967251fdc3826ad27d30e55258cfa4cdfd7c871 (diff)
parente5f934ddf0aa4ef9efbf45751bc00bebff768d99 (diff)
Merge pull request #1418 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/serializers/rest/account_featured_tag_serializer.rb')
-rw-r--r--app/serializers/rest/account_featured_tag_serializer.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/serializers/rest/account_featured_tag_serializer.rb b/app/serializers/rest/account_featured_tag_serializer.rb
new file mode 100644
index 000000000..d8d5fd68c
--- /dev/null
+++ b/app/serializers/rest/account_featured_tag_serializer.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class REST::AccountFeaturedTagSerializer < ActiveModel::Serializer
+  include RoutingHelper
+
+  attributes :id, :name, :url
+
+  def id
+    object.tag.id.to_s
+  end
+
+  def name
+    "##{object.name}"
+  end
+
+  def url
+    short_account_tag_url(object.account, object.tag)
+  end
+end