From b50d85138587481faac6b19640ca69340ac74102 Mon Sep 17 00:00:00 2001 From: KMY Date: Fri, 19 May 2023 19:05:35 +0900 Subject: [PATCH] Fix output 0 as count when user set hide counts --- app/controllers/activitypub/outboxes_controller.rb | 2 +- app/controllers/follower_accounts_controller.rb | 4 ++-- app/controllers/following_accounts_controller.rb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/activitypub/outboxes_controller.rb b/app/controllers/activitypub/outboxes_controller.rb index bf10ba762a..cce10cfccc 100644 --- a/app/controllers/activitypub/outboxes_controller.rb +++ b/app/controllers/activitypub/outboxes_controller.rb @@ -37,7 +37,7 @@ class ActivityPub::OutboxesController < ActivityPub::BaseController ActivityPub::CollectionPresenter.new( id: outbox_url, type: :ordered, - size: @account.statuses_count, + size: @account.user&.setting_hide_statuses_count ? 0 : @account.statuses_count, first: outbox_url(page: true), last: outbox_url(page: true, min_id: 0) ) diff --git a/app/controllers/follower_accounts_controller.rb b/app/controllers/follower_accounts_controller.rb index f35af5903c..0127495b89 100644 --- a/app/controllers/follower_accounts_controller.rb +++ b/app/controllers/follower_accounts_controller.rb @@ -63,7 +63,7 @@ class FollowerAccountsController < ApplicationController ActivityPub::CollectionPresenter.new( id: account_followers_url(@account, page: params.fetch(:page, 1)), type: :ordered, - size: @account.followers_count, + size: @account.user&.setting_hide_followers_count ? 0 : @account.followers_count, items: follows.map { |follow| ActivityPub::TagManager.instance.uri_for(follow.account) }, part_of: account_followers_url(@account), next: next_page_url, @@ -73,7 +73,7 @@ class FollowerAccountsController < ApplicationController ActivityPub::CollectionPresenter.new( id: account_followers_url(@account), type: :ordered, - size: @account.followers_count, + size: @account.user&.setting_hide_followers_count ? 0 : @account.followers_count, first: page_url(1) ) end diff --git a/app/controllers/following_accounts_controller.rb b/app/controllers/following_accounts_controller.rb index 2aa31bdf08..832bad1291 100644 --- a/app/controllers/following_accounts_controller.rb +++ b/app/controllers/following_accounts_controller.rb @@ -66,7 +66,7 @@ class FollowingAccountsController < ApplicationController ActivityPub::CollectionPresenter.new( id: account_following_index_url(@account, page: params.fetch(:page, 1)), type: :ordered, - size: @account.following_count, + size: @account.user&.setting_hide_following_count ? 0 : @account.following_count, items: follows.map { |follow| ActivityPub::TagManager.instance.uri_for(follow.target_account) }, part_of: account_following_index_url(@account), next: next_page_url, @@ -76,7 +76,7 @@ class FollowingAccountsController < ApplicationController ActivityPub::CollectionPresenter.new( id: account_following_index_url(@account), type: :ordered, - size: @account.following_count, + size: @account.user&.setting_hide_following_count ? 0 : @account.following_count, first: page_url(1) ) end