diff options
author | trwnh <a@trwnh.com> | 2020-12-23 09:43:38 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-23 16:43:38 +0100 |
commit | 4950e59cdcd59a181238d3d504398de188e19319 (patch) | |
tree | b0bb57f5f0fd34468e049069f9157690a5940c5f /app | |
parent | de57efd055c8c6af9e6e2aa450cea790546aabbc (diff) |
Use existing FeaturedTag serializer and delete AccountFeaturedTag serializer (#15415)
* Update featured_tags_controller.rb * Update featured_tag_serializer.rb * Update featured_tag_serializer.rb * Delete account_featured_tag_serializer.rb * please codeclimate * please codeclimate
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/api/v1/accounts/featured_tags_controller.rb | 2 | ||||
-rw-r--r-- | app/serializers/rest/account_featured_tag_serializer.rb | 15 | ||||
-rw-r--r-- | app/serializers/rest/featured_tag_serializer.rb | 8 |
3 files changed, 8 insertions, 17 deletions
diff --git a/app/controllers/api/v1/accounts/featured_tags_controller.rb b/app/controllers/api/v1/accounts/featured_tags_controller.rb index dc01b577c..0101fb469 100644 --- a/app/controllers/api/v1/accounts/featured_tags_controller.rb +++ b/app/controllers/api/v1/accounts/featured_tags_controller.rb @@ -7,7 +7,7 @@ class Api::V1::Accounts::FeaturedTagsController < Api::BaseController respond_to :json def index - render json: @featured_tags, each_serializer: REST::AccountFeaturedTagSerializer + render json: @featured_tags, each_serializer: REST::FeaturedTagSerializer end private diff --git a/app/serializers/rest/account_featured_tag_serializer.rb b/app/serializers/rest/account_featured_tag_serializer.rb deleted file mode 100644 index 84bef2e62..000000000 --- a/app/serializers/rest/account_featured_tag_serializer.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class REST::AccountFeaturedTagSerializer < ActiveModel::Serializer - include RoutingHelper - - attributes :id, :name, :url - - def id - object.tag.id.to_s - end - - def url - short_account_tag_url(object.account, object.tag) - end -end diff --git a/app/serializers/rest/featured_tag_serializer.rb b/app/serializers/rest/featured_tag_serializer.rb index 08121ff16..96adcc7d0 100644 --- a/app/serializers/rest/featured_tag_serializer.rb +++ b/app/serializers/rest/featured_tag_serializer.rb @@ -1,9 +1,15 @@ # frozen_string_literal: true class REST::FeaturedTagSerializer < ActiveModel::Serializer - attributes :id, :name, :statuses_count, :last_status_at + include RoutingHelper + + attributes :id, :name, :url, :statuses_count, :last_status_at def id object.id.to_s end + + def url + short_account_tag_url(object.account, object.tag) + end end |