Merge pull request #2740 from riking/badges_disabled

FIX: Do not perform grants if badges are disabled
This commit is contained in:
Sam 2014-09-03 22:19:51 +10:00
commit 1792941098
3 changed files with 7 additions and 1 deletions

View File

@ -8,6 +8,7 @@ module Jobs
every 1.day
def execute(args)
return unless SiteSetting.enable_badges
Badge.all.each do |b|
BadgeGranter.backfill(b)
end

View File

@ -68,6 +68,7 @@ class BadgeGranter
end
def self.queue_badge_grant(type,opt)
return unless SiteSetting.enable_badges
payload = nil
case type
@ -209,6 +210,7 @@ class BadgeGranter
MAX_ITEMS_FOR_DELTA = 200
def self.backfill(badge, opts=nil)
return unless SiteSetting.enable_badges
return unless badge.query.present? && badge.enabled
post_ids = user_ids = nil

View File

@ -108,7 +108,10 @@ class Guardian
alias :can_move_posts? :can_moderate?
alias :can_see_flags? :can_moderate?
alias :can_send_activation_email? :can_moderate?
alias :can_grant_badges? :can_moderate?
def can_grant_badges?(_user)
SiteSetting.enable_badges && is_staff?
end
def can_see_group?(group)
group.present? && (is_admin? || group.visible?)