From 56a1c70fae51acd3395a381f080c8535e93af801 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 21 Aug 2022 15:02:49 +0200 Subject: [PATCH] add `admin?` shorthand to users --- app/models/user.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/user.rb b/app/models/user.rb index a12c8248..a8f57dd5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -141,6 +141,10 @@ class User < ApplicationRecord has_role?(:moderator) || has_role?(:administrator) end + def admin? + has_role?(:administrator) + end + # region stuff used for reporting/moderation def report(object, reason = nil) existing = Report.find_by(type: "Reports::#{object.class}", target_id: object.id, user_id: self.id, deleted: false)