mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 09:10:25 +08:00
FIX: wasn't able to use the same username when taking over a staged account
This commit is contained in:
parent
7d8cd84fa6
commit
62a5b174e1
3 changed files with 14 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue