Revert "Remove posts count and last posts from ActivityPub representation of hashtag collections (#23460)"

This reverts commit 832595d1e7.
This commit is contained in:
Yamagishi Kazutoshi 2023-02-09 23:26:52 +09:00 committed by GitHub
parent f23d30100a
commit 4d26dc2212

View file

@ -11,7 +11,7 @@ class TagsController < ApplicationController
before_action :authenticate_user!, if: :whitelist_mode? before_action :authenticate_user!, if: :whitelist_mode?
before_action :set_local before_action :set_local
before_action :set_tag before_action :set_tag
before_action :set_statuses, if: -> { request.format == :rss } before_action :set_statuses
before_action :set_instance_presenter before_action :set_instance_presenter
skip_before_action :require_functional!, unless: :whitelist_mode? skip_before_action :require_functional!, unless: :whitelist_mode?
@ -44,8 +44,13 @@ class TagsController < ApplicationController
end end
def set_statuses def set_statuses
case request.format&.to_sym
when :json
@statuses = cache_collection(TagFeed.new(@tag, current_account, local: @local).get(PAGE_SIZE, params[:max_id], params[:since_id], params[:min_id]), Status)
when :rss
@statuses = cache_collection(TagFeed.new(@tag, nil, local: @local).get(limit_param), Status) @statuses = cache_collection(TagFeed.new(@tag, nil, local: @local).get(limit_param), Status)
end end
end
def set_instance_presenter def set_instance_presenter
@instance_presenter = InstancePresenter.new @instance_presenter = InstancePresenter.new
@ -59,6 +64,8 @@ class TagsController < ApplicationController
ActivityPub::CollectionPresenter.new( ActivityPub::CollectionPresenter.new(
id: tag_url(@tag), id: tag_url(@tag),
type: :ordered, type: :ordered,
size: @tag.statuses.count,
items: @statuses.map { |status| ActivityPub::TagManager.instance.uri_for(status) }
) )
end end
end end