Conflicts: - `app/controllers/activitypub/collections_controller.rb`: Conflict caused because we have additional code to make sure pinned local-only toots don't get rendered on the ActivityPub endpoints. Ported upstream changes.main
commit
e5f934ddf0
@ -0,0 +1,22 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class Api::V1::Accounts::FeaturedTagsController < Api::BaseController
|
||||||
|
before_action :set_account
|
||||||
|
before_action :set_featured_tags
|
||||||
|
|
||||||
|
respond_to :json
|
||||||
|
|
||||||
|
def index
|
||||||
|
render json: @featured_tags, each_serializer: REST::AccountFeaturedTagSerializer
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_account
|
||||||
|
@account = Account.find(params[:account_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_featured_tags
|
||||||
|
@featured_tags = @account.featured_tags
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,23 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class ActivityPub::HashtagSerializer < ActivityPub::Serializer
|
||||||
|
include RoutingHelper
|
||||||
|
|
||||||
|
attributes :type, :href, :name
|
||||||
|
|
||||||
|
def type
|
||||||
|
'Hashtag'
|
||||||
|
end
|
||||||
|
|
||||||
|
def name
|
||||||
|
"##{object.name}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def href
|
||||||
|
if object.class.name == 'FeaturedTag'
|
||||||
|
short_account_tag_url(object.account, object.tag)
|
||||||
|
else
|
||||||
|
tag_url(object)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -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
|
Loading…
Reference in new issue