mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 10:33:51 +08:00
FIX: Do not perform grants if badges are disabled
This commit is contained in:
parent
defe1dd86f
commit
ee812eb447
|
@ -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
|
||||
|
|
|
@ -68,6 +68,7 @@ class BadgeGranter
|
|||
end
|
||||
|
||||
def self.queue_badge_grant(type,opt)
|
||||
return unless SiteSetting.enable_badges
|
||||
payload = nil
|
||||
|
||||
case type
|
||||
|
@ -208,6 +209,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
|
||||
|
|
|
@ -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?)
|
||||
|
|
Loading…
Reference in New Issue
Block a user