Add administrative webhooks (#18510)
* Add administrative webhooks * Fix error when webhook is deleted before delivery worker runs
This commit is contained in:
parent
17ba5e1e61
commit
a2871cd747
33 changed files with 530 additions and 8 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue