From 9d2e41a54763a61edddd13fdb9b665ba8c812303 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 25 Jul 2025 09:49:22 -0400 Subject: [PATCH] Fix `Style/GuardClause` in unmute service --- app/services/unmute_service.rb | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/app/services/unmute_service.rb b/app/services/unmute_service.rb index 0a9604bae2e..bb32193da79 100644 --- a/app/services/unmute_service.rb +++ b/app/services/unmute_service.rb @@ -6,12 +6,23 @@ class UnmuteService < BaseService account.unmute!(target_account) - if account.following?(target_account) - MergeWorker.perform_async(target_account.id, account.id, 'home') + process_merges(account, target_account) if account.following?(target_account) + end - MergeWorker.push_bulk(account.owned_lists.with_list_account(target_account).pluck(:id)) do |list_id| - [target_account.id, list_id, 'list'] - end + private + + def process_merges(account, target_account) + MergeWorker.perform_async(target_account.id, account.id, 'home') + + MergeWorker.push_bulk(mergeable_list_ids(account, target_account)) do |list_id| + [target_account.id, list_id, 'list'] end end + + def mergeable_list_ids(account, target_account) + account + .owned_lists + .with_list_account(target_account) + .pluck(:id) + end end