Normalize current_username on account migration (#38183)

This commit is contained in:
Matt Jankowski authored and GitHub committed 2026-03-13 09:33:02 +00:00
1 parent 377952703c
commit 6416724f75
3 files changed
+42 -9

No files matched your search

+4 -1
View File
@@ -25,7 +25,10 @@ class AccountMigration < ApplicationRecord
before_validation :set_target_account
before_validation :set_followers_count
attribute :current_username, :string
normalizes :acct, with: ->(acct) { acct.strip.delete_prefix('@') }
normalizes :current_username, with: ->(value) { value.strip.delete_prefix('@') }
validates :acct, presence: true, domain: { acct: true }
validate :validate_migration_cooldown
@@ -33,7 +36,7 @@ class AccountMigration < ApplicationRecord
scope :within_cooldown, -> { where(created_at: cooldown_duration_ago..) }
attr_accessor :current_password, :current_username
attr_accessor :current_password
def self.cooldown_duration_ago
Time.current - COOLDOWN_PERIOD