mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Merge pull request #3035 from oblakeerickson/update_username_return_json
Update username should return a json response
This commit is contained in:
commit
f5317a519f
@ -91,7 +91,10 @@ class UsersController < ApplicationController
|
|||||||
result = user.change_username(params[:new_username])
|
result = user.change_username(params[:new_username])
|
||||||
raise Discourse::InvalidParameters.new(:new_username) unless result
|
raise Discourse::InvalidParameters.new(:new_username) unless result
|
||||||
|
|
||||||
render nothing: true
|
render json: {
|
||||||
|
id: user.id,
|
||||||
|
username: user.username
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_emails
|
def check_emails
|
||||||
|
@ -636,6 +636,11 @@ describe UsersController do
|
|||||||
response.should be_success
|
response.should be_success
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should return a JSON response with the updated username' do
|
||||||
|
xhr :put, :username, username: user.username, new_username: new_username
|
||||||
|
::JSON.parse(response.body)['username'].should == new_username
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user