Adds grant and revoke moderation buttons so admins can make users moderators

This commit is contained in:
Ismael Abreu
2013-02-12 22:58:08 +00:00
parent 51473a95b4
commit 80bec6efc9
10 changed files with 163 additions and 4 deletions

View File

@@ -131,6 +131,23 @@ class Guardian
true
end
def can_revoke_moderation?(moderator)
return false unless @user.try(:admin?)
return false if moderator.blank?
return false if @user.id == moderator.id
return false unless moderator.trust_level == TrustLevel.Levels[:moderator]
true
end
def can_grant_moderation?(user)
return false unless @user.try(:admin?)
return false if user.blank?
return false if @user.id == user.id
return false if user.admin?
return false if user.has_trust_level?(:moderator)
true
end
# Can we see who acted on a post in a particular way?
def can_see_post_actors?(topic, post_action_type_id)
return false unless topic.present?