mirror of
https://github.com/discourse/discourse.git
synced 2025-03-24 05:25:41 +08:00
DEV: call 'enqueue_hooks' method only if active webhooks exist
This commit is contained in:
parent
f2c3415548
commit
27e7f2bee0
@ -7,11 +7,16 @@ module HasDestroyedWebHook
|
||||
|
||||
def enqueue_destroyed_web_hook
|
||||
type = self.class.name.underscore.to_sym
|
||||
payload = WebHook.generate_payload(type, self) if WebHook.active_web_hooks(type).exists?
|
||||
yield
|
||||
WebHook.enqueue_hooks(type, "#{type}_destroyed".to_sym,
|
||||
id: id,
|
||||
payload: payload
|
||||
)
|
||||
|
||||
if WebHook.active_web_hooks(type).exists?
|
||||
payload = WebHook.generate_payload(type, self)
|
||||
yield
|
||||
WebHook.enqueue_hooks(type, "#{type}_destroyed".to_sym,
|
||||
id: id,
|
||||
payload: payload
|
||||
)
|
||||
else
|
||||
yield
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user