Merge pull request #3050 from evazion/fix-user-name-changes
Fix username changes forcing new name to lowercase.
This commit is contained in:
@@ -37,10 +37,6 @@ class UserNameChangeRequest < ActiveRecord::Base
|
|||||||
status == "pending"
|
status == "pending"
|
||||||
end
|
end
|
||||||
|
|
||||||
def desired_name=(name)
|
|
||||||
super(User.normalize_name(name))
|
|
||||||
end
|
|
||||||
|
|
||||||
def feedback
|
def feedback
|
||||||
UserFeedback.for_user(user_id).order("id desc")
|
UserFeedback.for_user(user_id).order("id desc")
|
||||||
end
|
end
|
||||||
|
|||||||
6
test/factories/user_name_change_request.rb
Normal file
6
test/factories/user_name_change_request.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
FactoryGirl.define do
|
||||||
|
factory(:user_name_change_request) do
|
||||||
|
desired_name {FFaker::Internet.user_name}
|
||||||
|
change_reason {FFaker::Lorem.sentence}
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -91,6 +91,13 @@ class UserNameChangeRequestTest < ActiveSupport::TestCase
|
|||||||
assert_equal(["Desired name already exists"], req.errors.full_messages)
|
assert_equal(["Desired name already exists"], req.errors.full_messages)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "not convert the desired name to lower case" do
|
||||||
|
uncr = FactoryGirl.create(:user_name_change_request, user: @requester, original_name: "provence.", desired_name: "Provence")
|
||||||
|
CurrentUser.scoped(@admin) { uncr.approve! }
|
||||||
|
|
||||||
|
assert_equal("Provence", @requester.name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user