mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Webhooks and Event for user being granted a badge
Adding a webhook for badge revocation is left for future work as it's relatively rare.
This commit is contained in:
@@ -410,7 +410,7 @@ class BadgeGranter
|
||||
end
|
||||
|
||||
def self.send_notification(user_id, username, locale, badge)
|
||||
I18n.with_locale(notification_locale(locale)) do
|
||||
notification = I18n.with_locale(notification_locale(locale)) do
|
||||
Notification.create!(
|
||||
user_id: user_id,
|
||||
notification_type: Notification.types[:granted_badge],
|
||||
@@ -423,6 +423,10 @@ class BadgeGranter
|
||||
}.to_json
|
||||
)
|
||||
end
|
||||
|
||||
DiscourseEvent.trigger(:user_badge_granted, badge, user_id)
|
||||
|
||||
notification
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user