REFACTOR: Simplify user title comparison

Follow-up to 6d6ffe51
This commit is contained in:
Gerhard Schlager 2020-01-08 18:37:28 +01:00
parent 92a9ae6ab0
commit 2683b7793b

View File

@ -316,8 +316,7 @@ class Guardian
return true if user.badges
.where(allow_title: true)
.pluck(:name)
.map { |name| Badge.display_name(name) }
.include?(title)
.any? { |name| Badge.display_name(name) == title }
user.groups.where(title: title).exists?
end