FEATURE: Add a webhook for user notifications

If enabled, this will fire a webhook whenever a user's notification has
been created. This could potentially be a lot of data depending on your
forum, and should be used carefully since it includes everything all users
will see in their feeds.
This commit is contained in:
Robin Ward
2019-08-15 14:45:30 -04:00
parent 69498a58e9
commit b4878cde6f
7 changed files with 35 additions and 0 deletions

View File

@@ -26,6 +26,10 @@ class Notification < ActiveRecord::Base
after_commit :send_email, on: :create
after_commit :refresh_notification_count, on: [:create, :update, :destroy]
after_commit(on: :create) do
DiscourseEvent.trigger(:notification_created, self)
end
def self.ensure_consistency!
DB.exec(<<~SQL, Notification.types[:private_message])
DELETE