mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 03:06:53 +08:00
UX: user preferences allows users to choose which title to use from their badges and groups
This commit is contained in:
@ -215,8 +215,11 @@ class Guardian
|
||||
can_administer?(user) && !user.moderator?
|
||||
end
|
||||
|
||||
def can_grant_title?(user)
|
||||
user && is_staff?
|
||||
def can_grant_title?(user, title = nil)
|
||||
return true if user && is_staff?
|
||||
return false if user != @user
|
||||
return true if user.badges.where(name: title, allow_title: true).exists?
|
||||
user.groups.where(title: title).exists?
|
||||
end
|
||||
|
||||
def can_change_primary_group?(user)
|
||||
|
Reference in New Issue
Block a user