From ff20ce9acf9d4974b5a91d1161a0b7e589fa50d1 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 30 Jan 2026 10:15:22 +0100 Subject: [PATCH] Clear affected relationship cache on Move activities (#37664) --- app/workers/move_worker.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/workers/move_worker.rb b/app/workers/move_worker.rb index 1a5745a86..d0103dc66 100644 --- a/app/workers/move_worker.rb +++ b/app/workers/move_worker.rb @@ -64,6 +64,16 @@ class MoveWorker .in_batches do |follows| ListAccount.where(follow: follows).in_batches.update_all(account_id: @target_account.id) num_moved += follows.update_all(target_account_id: @target_account.id) + + # Clear any relationship cache, since callbacks are not called + Rails.cache.delete_multi(follows.flat_map do |follow| + [ + ['relationship', follow.account_id, follow.target_account_id], + ['relationship', follow.target_account_id, follow.account_id], + ['relationship', follow.account_id, @target_account.id], + ['relationship', @target_account.id, follow.account_id], + ] + end) end num_moved