diff --git a/app/models/user.rb b/app/models/user.rb index 50e21918..c27d516f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -126,4 +126,13 @@ class User < ActiveRecord::Base increment! :commented_count answer.increment! :comment_count end + + # @return [Boolean] is the user a moderator? + def mod? + self.moderator? || self.admin? + end + + def report(object) + Report.create(type: "Reports::#{object.class}", target_id: object.id, user_id: self.id) + end end