From a84a3912e5d1b4e56521057e2b9c3a04bae043fd Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 14 Oct 2024 21:41:19 -0700 Subject: [PATCH] remove account on_behalf_of entirely since it doesn't do anything in this context anyway --- .env.production.sample | 2 ++ app/controllers/api/v1/statuses_controller.rb | 1 - app/workers/activitypub/fetch_all_replies_worker.rb | 6 ++---- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.env.production.sample b/.env.production.sample index 6e109a64a978a2..39818ccfeaa13a 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -306,8 +306,10 @@ AUTOFOLLOW= # When a user expands a post (DetailedStatus view), fetch all of its replies # (default: true if unset, set explicitly to ``false`` to disable) FETCH_REPLIES_ENABLED=true + # Period to wait between fetching replies (in minutes) FETCH_REPLIES_DEBOUNCE=15 + # Period to wait after a post is first created before fetching its replies (in minutes) FETCH_REPLIES_CREATED_RECENTLY=5 diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index 985e524070a78d..c9ce8e348c00ae 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -62,7 +62,6 @@ def context if !current_account.nil? && @status.should_fetch_replies? ActivityPub::FetchAllRepliesWorker.perform_async( @status.id, - current_account.id, { allow_synchronous_requests: true, } diff --git a/app/workers/activitypub/fetch_all_replies_worker.rb b/app/workers/activitypub/fetch_all_replies_worker.rb index 53e132f61ee6f9..c739cafbb183ac 100644 --- a/app/workers/activitypub/fetch_all_replies_worker.rb +++ b/app/workers/activitypub/fetch_all_replies_worker.rb @@ -14,10 +14,8 @@ class ActivityPub::FetchAllRepliesWorker # Global max replies to fetch per request (all replies, recursively) MAX_REPLIES = 1000 - def perform(parent_status_id, current_account_id = nil, options = {}) + def perform(parent_status_id, options = {}) @parent_status = Status.find(parent_status_id) - @current_account_id = current_account_id - @current_account = @current_account_id.nil? ? nil : Account.find(@current_account_id) Rails.logger.debug { "FetchAllRepliesWorker - #{parent_status_id}: Fetching all replies for status: #{@parent_status}" } uris_to_fetch = get_replies(@parent_status.uri, options) @@ -50,7 +48,7 @@ def get_replies(status_uri, options = {}) def get_replies_uri(parent_status_uri) begin - json_status = fetch_resource(parent_status_uri, true, @current_account) + json_status = fetch_resource(parent_status_uri, true) replies_collection_or_uri = json_status['replies'] Rails.logger.debug { "FetchAllRepliesWorker - #{@parent_status_id}: replies URI was nil" } if replies_collection_or_uri.nil? replies_collection_or_uri