From 258e5c4938e88183fec010dd0af1e358dc482a2d Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 12 Aug 2025 14:19:29 +0200 Subject: [PATCH] Fix interaction policy changes in implicit updates not being saved (#35751) --- .../process_status_update_service.rb | 2 +- .../fetch_remote_status_service_spec.rb | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/services/activitypub/process_status_update_service.rb b/app/services/activitypub/process_status_update_service.rb index 023eef19a02..0da1335b5cc 100644 --- a/app/services/activitypub/process_status_update_service.rb +++ b/app/services/activitypub/process_status_update_service.rb @@ -74,7 +74,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService end def update_interaction_policies! - @status.quote_approval_policy = @status_parser.quote_policy + @status.update(quote_approval_policy: @status_parser.quote_policy) end def update_media_attachments! diff --git a/spec/services/activitypub/fetch_remote_status_service_spec.rb b/spec/services/activitypub/fetch_remote_status_service_spec.rb index 2503a58ac20..07d05d762f1 100644 --- a/spec/services/activitypub/fetch_remote_status_service_spec.rb +++ b/spec/services/activitypub/fetch_remote_status_service_spec.rb @@ -316,6 +316,23 @@ RSpec.describe ActivityPub::FetchRemoteStatusService do expect(existing_status.edits).to_not be_empty end end + + context 'with an implicit update to quoting policy' do + let(:object) do + note.merge({ + 'content' => existing_status.text, + 'interactionPolicy' => { + 'canQuote' => { + 'automaticApproval' => ['https://www.w3.org/ns/activitystreams#Public'], + }, + }, + }) + end + + it 'updates status' do + expect(existing_status.reload.quote_approval_policy).to eq(Status::QUOTE_APPROVAL_POLICY_FLAGS[:public] << 16) + end + end end end