From 49cbee383612bb58efeebd3377acc0d618fbf80e Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 13 Sep 2024 04:43:21 -0400 Subject: [PATCH] Remove unused argument from `AccountMigration.within_cooldown` (#31892) --- app/models/account_migration.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/account_migration.rb b/app/models/account_migration.rb index dc22e32942..7a01e250e2 100644 --- a/app/models/account_migration.rb +++ b/app/models/account_migration.rb @@ -31,10 +31,14 @@ class AccountMigration < ApplicationRecord validate :validate_migration_cooldown validate :validate_target_account - scope :within_cooldown, ->(now = Time.now.utc) { where(arel_table[:created_at].gteq(now - COOLDOWN_PERIOD)) } + scope :within_cooldown, -> { where(created_at: cooldown_duration_ago..) } attr_accessor :current_password, :current_username + def self.cooldown_duration_ago + Time.current - COOLDOWN_PERIOD + end + def save_with_challenge(current_user) if current_user.encrypted_password.present? errors.add(:current_password, :invalid) unless current_user.valid_password?(current_password)