users: fix bug in changing usernames.
Fix the change username page not showing the user's current name when a mod is changing a user's name.
This commit is contained in:
@@ -6,7 +6,7 @@ class UserNameChangeRequestsController < ApplicationController
|
||||
skip_before_action :redirect_if_name_invalid?
|
||||
|
||||
def new
|
||||
user = User.find_by_name(params[:id]) || CurrentUser.user
|
||||
user = params[:id].present? ? User.find(params[:id]) : CurrentUser.user
|
||||
@change_request = authorize UserNameChangeRequest.new(user: user, **permitted_attributes(UserNameChangeRequest))
|
||||
respond_with(@change_request)
|
||||
end
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
<h1>Change Name</h1>
|
||||
<% end %>
|
||||
|
||||
<% if CurrentUser.user.name_invalid? %>
|
||||
<% if @change_request.user.name_invalid? %>
|
||||
<p> Your current username is invalid. You must change your username to continue
|
||||
using <%= Danbooru.config.canonical_app_name %>.</p>
|
||||
|
||||
<p>
|
||||
Current name: <b><%= CurrentUser.user.name %></b>.<br>
|
||||
Error: <%= CurrentUser.user.name_errors.full_messages.join(". ").html_safe %>.
|
||||
Current name: <b><%= @change_request.user.name %></b>.<br>
|
||||
Error: <%= @change_request.user.name_errors.full_messages.join(". ").html_safe %>.
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user