summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2023-02-09 23:26:52 +0900
committerGitHub <noreply@github.com>2023-02-09 23:26:52 +0900
commit4d26dc221250e2da0258c41bbb37f50964c3f2d9 (patch)
treefcf5ed91ed0c776917a6b629200718dbe218966b
parentf23d30100a3a85d4d099e9ea95a97b1dd5a3f9b0 (diff)
Revert "Remove posts count and last posts from ActivityPub representation of hashtag collections (#23460)"revert-23460-fixes/activitypub-hashtag
-rw-r--r--app/controllers/tags_controller.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
index 750e15fa31b..65017acba30 100644
--- a/app/controllers/tags_controller.rb
+++ b/app/controllers/tags_controller.rb
@@ -11,7 +11,7 @@ class TagsController < ApplicationController
before_action :authenticate_user!, if: :whitelist_mode?
before_action :set_local
before_action :set_tag
- before_action :set_statuses, if: -> { request.format == :rss }
+ before_action :set_statuses
before_action :set_instance_presenter
skip_before_action :require_functional!, unless: :whitelist_mode?
@@ -44,7 +44,12 @@ class TagsController < ApplicationController
end
def set_statuses
- @statuses = cache_collection(TagFeed.new(@tag, nil, local: @local).get(limit_param), Status)
+ 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)
+ end
end
def set_instance_presenter
@@ -59,6 +64,8 @@ class TagsController < ApplicationController
ActivityPub::CollectionPresenter.new(
id: tag_url(@tag),
type: :ordered,
+ size: @tag.statuses.count,
+ items: @statuses.map { |status| ActivityPub::TagManager.instance.uri_for(status) }
)
end
end