mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 23:36:11 +08:00
FIX: wasn't able to use the same username when taking over a staged account
This commit is contained in:
@ -484,9 +484,16 @@ describe User do
|
||||
|
||||
it 'returns false when a username is reserved' do
|
||||
SiteSetting.reserved_usernames = 'test|donkey'
|
||||
|
||||
expect(User.username_available?('tESt')).to eq(false)
|
||||
end
|
||||
|
||||
it "returns true when username is associated to a staged user of the same email" do
|
||||
staged = Fabricate(:user, staged: true, email: "foo@bar.com")
|
||||
expect(User.username_available?(staged.username, staged.primary_email.email)).to eq(true)
|
||||
|
||||
user = Fabricate(:user, email: "bar@foo.com")
|
||||
expect(User.username_available?(user.username, user.primary_email.email)).to eq(false)
|
||||
end
|
||||
end
|
||||
|
||||
describe '.reserved_username?' do
|
||||
|
Reference in New Issue
Block a user