user name changes: fix permission inconsistencies.

* Let moderators see name changes for deleted users on the user name
  change requests index and show pages. Before they could see name changes
  for deleted users on user profiles, but not on the user name changes index.

* Let members see previous names on profile pages. Before they could see
  previous names on the user name changes index, but not on profile pages
  (ref: #4382).
This commit is contained in:
evazion
2020-04-03 21:59:28 -05:00
parent 14c1dc2f0c
commit 6b1d73ddae
4 changed files with 15 additions and 13 deletions

View File

@@ -9,7 +9,7 @@ class UserNameChangeRequest < ApplicationRecord
after_create :update_name!
def self.visible(user)
if user.is_admin?
if user.is_moderator?
all
elsif user.is_member?
where(user: User.undeleted)