mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 23:13:40 +08:00
REFACTOR: Removes double check of site setting in badge granter
...and uses `update!` because the result of `update` isn't used
This commit is contained in:
parent
8e47532304
commit
f30c5a5c3a
|
@ -71,16 +71,14 @@ class BadgeGranter
|
||||||
seq: seq)
|
seq: seq)
|
||||||
|
|
||||||
return unless SiteSetting.enable_badges
|
return unless SiteSetting.enable_badges
|
||||||
|
|
||||||
if @granted_by != Discourse.system_user
|
if @granted_by != Discourse.system_user
|
||||||
StaffActionLogger.new(@granted_by).log_badge_grant(user_badge)
|
StaffActionLogger.new(@granted_by).log_badge_grant(user_badge)
|
||||||
end
|
end
|
||||||
|
|
||||||
if SiteSetting.enable_badges?
|
|
||||||
unless @badge.badge_type_id == BadgeType::Bronze && user_badge.granted_at < 2.days.ago
|
unless @badge.badge_type_id == BadgeType::Bronze && user_badge.granted_at < 2.days.ago
|
||||||
notification = self.class.send_notification(@user.id, @user.username, @user.effective_locale, @badge)
|
notification = self.class.send_notification(@user.id, @user.username, @user.effective_locale, @badge)
|
||||||
|
user_badge.update!(notification_id: notification.id)
|
||||||
user_badge.update notification_id: notification.id
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user