Browse Source

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
master
trwnh 3 years ago
committed by GitHub
parent
commit
4950e59cdc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 17 deletions
  1. +1
    -1
      app/controllers/api/v1/accounts/featured_tags_controller.rb
  2. +0
    -15
      app/serializers/rest/account_featured_tag_serializer.rb
  3. +7
    -1
      app/serializers/rest/featured_tag_serializer.rb

+ 1
- 1
app/controllers/api/v1/accounts/featured_tags_controller.rb View File

@ -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

+ 0
- 15
app/serializers/rest/account_featured_tag_serializer.rb View File

@ -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

+ 7
- 1
app/serializers/rest/featured_tag_serializer.rb View File

@ -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

Loading…
Cancel
Save