From b464b87c2be774ce2972b217ae791366ed35bfbc Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 28 Jul 2025 04:02:21 -0400 Subject: [PATCH] Use `moved?` query method where relevant (#35542) --- app/controllers/settings/migration/redirects_controller.rb | 2 +- app/models/account_migration.rb | 2 +- app/models/form/redirect.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/settings/migration/redirects_controller.rb b/app/controllers/settings/migration/redirects_controller.rb index d850e05e94f..08b01d6b108 100644 --- a/app/controllers/settings/migration/redirects_controller.rb +++ b/app/controllers/settings/migration/redirects_controller.rb @@ -22,7 +22,7 @@ class Settings::Migration::RedirectsController < Settings::BaseController end def destroy - if current_account.moved_to_account_id.present? + if current_account.moved? current_account.update!(moved_to_account: nil) ActivityPub::UpdateDistributionWorker.perform_async(current_account.id) end diff --git a/app/models/account_migration.rb b/app/models/account_migration.rb index 7bda388f2a8..6cdc7128ef4 100644 --- a/app/models/account_migration.rb +++ b/app/models/account_migration.rb @@ -74,7 +74,7 @@ class AccountMigration < ApplicationRecord errors.add(:acct, I18n.t('migrations.errors.not_found')) else errors.add(:acct, I18n.t('migrations.errors.missing_also_known_as')) unless target_account.also_known_as.include?(ActivityPub::TagManager.instance.uri_for(account)) - errors.add(:acct, I18n.t('migrations.errors.already_moved')) if account.moved_to_account_id.present? && account.moved_to_account_id == target_account.id + errors.add(:acct, I18n.t('migrations.errors.already_moved')) if account.moved? && account.moved_to_account_id == target_account.id errors.add(:acct, I18n.t('migrations.errors.move_to_self')) if account.id == target_account.id end end diff --git a/app/models/form/redirect.rb b/app/models/form/redirect.rb index c5b3c1f8f39..6ab95f21f1f 100644 --- a/app/models/form/redirect.rb +++ b/app/models/form/redirect.rb @@ -40,7 +40,7 @@ class Form::Redirect if target_account.nil? errors.add(:acct, I18n.t('migrations.errors.not_found')) else - errors.add(:acct, I18n.t('migrations.errors.already_moved')) if account.moved_to_account_id.present? && account.moved_to_account_id == target_account.id + errors.add(:acct, I18n.t('migrations.errors.already_moved')) if account.moved? && account.moved_to_account_id == target_account.id errors.add(:acct, I18n.t('migrations.errors.move_to_self')) if account.id == target_account.id end end