mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
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
This commit is contained in:
parent
de57efd055
commit
4950e59cdc
@ -7,7 +7,7 @@ class Api::V1::Accounts::FeaturedTagsController < Api::BaseController
|
|||||||
respond_to :json
|
respond_to :json
|
||||||
|
|
||||||
def index
|
def index
|
||||||
render json: @featured_tags, each_serializer: REST::AccountFeaturedTagSerializer
|
render json: @featured_tags, each_serializer: REST::FeaturedTagSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -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
|
|
@ -1,9 +1,15 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class REST::FeaturedTagSerializer < ActiveModel::Serializer
|
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
|
def id
|
||||||
object.id.to_s
|
object.id.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def url
|
||||||
|
short_account_tag_url(object.account, object.tag)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user