add `admin?` shorthand to users
This commit is contained in:
parent
ffc0ba05e1
commit
56a1c70fae
|
@ -141,6 +141,10 @@ class User < ApplicationRecord
|
||||||
has_role?(:moderator) || has_role?(:administrator)
|
has_role?(:moderator) || has_role?(:administrator)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def admin?
|
||||||
|
has_role?(:administrator)
|
||||||
|
end
|
||||||
|
|
||||||
# region stuff used for reporting/moderation
|
# region stuff used for reporting/moderation
|
||||||
def report(object, reason = nil)
|
def report(object, reason = nil)
|
||||||
existing = Report.find_by(type: "Reports::#{object.class}", target_id: object.id, user_id: self.id, deleted: false)
|
existing = Report.find_by(type: "Reports::#{object.class}", target_id: object.id, user_id: self.id, deleted: false)
|
||||||
|
|
Loading…
Reference in New Issue