0
0
Fork 0

Add administrative webhooks (#18510)

* Add administrative webhooks

* Fix error when webhook is deleted before delivery worker runs
This commit is contained in:
Eugen Rochko 2022-06-09 21:57:36 +02:00 committed by GitHub
parent 17ba5e1e61
commit a2871cd747
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 530 additions and 8 deletions

View file

@ -55,6 +55,8 @@ class Report < ApplicationRecord
before_validation :set_uri, only: :create
after_create_commit :trigger_webhooks
def object_type
:flag
end
@ -143,4 +145,8 @@ class Report < ApplicationRecord
errors.add(:rule_ids, I18n.t('reports.errors.invalid_rules')) unless rules.size == rule_ids&.size
end
def trigger_webhooks
TriggerWebhookWorker.perform_async('report.created', 'Report', id)
end
end