Remove unused argument from AccountMigration.within_cooldown (#31892)

This commit is contained in:
Matt Jankowski 2024-09-13 04:43:21 -04:00 committed by GitHub
parent 353ade767b
commit 49cbee3836
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)