mirror of
https://github.com/mastodon/mastodon.git
synced 2025-11-29 02:50:46 +00:00
Normalize current_username on account migration
This commit is contained in:
parent
ed3710e58f
commit
a176cc5cf1
|
|
@ -26,6 +26,7 @@ class AccountMigration < ApplicationRecord
|
|||
before_validation :set_followers_count
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@ RSpec.describe AccountMigration do
|
|||
describe 'acct' do
|
||||
it { is_expected.to normalize(:acct).from(' @username@domain ').to('username@domain') }
|
||||
end
|
||||
|
||||
describe 'current_username' do
|
||||
it { is_expected.to normalize(:current_username).from(' @username ').to('username') }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'Validations' do
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user