FIX: unstable username when dinopark username taken
Taken usernames would change on every profile refresh. https://github.com/mozilla/discourse/issues/183
This commit is contained in:
Родитель
95249527ff
Коммит
ade12b37a3
|
@ -14,7 +14,7 @@ module MozillaIAM
|
|||
return if User.reserved_username? username
|
||||
|
||||
if @user.username.downcase != username.downcase
|
||||
username = UserNameSuggester.find_available_username_based_on(username)
|
||||
username = UserNameSuggester.find_available_username_based_on(username, @user.username)
|
||||
end
|
||||
|
||||
unless @user.change_username(username)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# name: mozilla-iam
|
||||
# about: A plugin to integrate Discourse with Mozilla's Identity and Access Management (IAM) system
|
||||
# version: 1.2.0-alpha.8
|
||||
# version: 1.2.0-alpha.9
|
||||
# authors: Leo McArdle
|
||||
# url: https://github.com/mozilla/discourse-mozilla-iam
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ describe MozillaIAM::Profile do
|
|||
Fabricate(:user, username: username_after)
|
||||
Fabricate(:user, username: "#{username_after}1")
|
||||
profile.send(:update_username)
|
||||
profile.send(:update_username)
|
||||
user.reload
|
||||
expect(user.username).to_not eq username_before
|
||||
expect(user.username).to eq "#{username_after}2"
|
||||
|
@ -68,6 +69,7 @@ describe MozillaIAM::Profile do
|
|||
Fabricate(:user, username: "johnsmi#{n}")
|
||||
end
|
||||
profile.send(:update_username)
|
||||
profile.send(:update_username)
|
||||
user.reload
|
||||
expect(user.username).to_not eq username_before
|
||||
expect(user.username).to eq "Johnsm10"
|
||||
|
|
Загрузка…
Ссылка в новой задаче