pundit: convert user name change requests to pundit.

Fix discrepancy between index action and show action. The index
action allowed members to see name changes for undeleted users, but the
show action didn't.
This commit is contained in:
evazion
2020-03-17 05:17:57 -05:00
parent db63b6d44f
commit 565a6572a7
5 changed files with 39 additions and 28 deletions

View File

@@ -322,6 +322,10 @@ class User < ApplicationRecord
User.level_string(value || level)
end
def is_deleted?
name.match?(/\Auser_[0-9]+~*\z/)
end
def is_anonymous?
level == Levels::ANONYMOUS
end