mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
Permit changing my own username's case without an error saying it is already taken
This commit is contained in:
@ -96,6 +96,9 @@ class UsersController < ApplicationController
|
||||
def check_username
|
||||
params.require(:username)
|
||||
|
||||
# The special case where someone is changing the case of their own username
|
||||
return render(json: {available: true}) if current_user and params[:username].downcase == current_user.username.downcase
|
||||
|
||||
validator = UsernameValidator.new(params[:username])
|
||||
if !validator.valid_format?
|
||||
render json: {errors: validator.errors}
|
||||
|
Reference in New Issue
Block a user