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
|
def enqueue_destroyed_web_hook
|
||||||
type = self.class.name.underscore.to_sym
|
type = self.class.name.underscore.to_sym
|
||||||
payload = WebHook.generate_payload(type, self) if WebHook.active_web_hooks(type).exists?
|
|
||||||
|
if WebHook.active_web_hooks(type).exists?
|
||||||
|
payload = WebHook.generate_payload(type, self)
|
||||||
yield
|
yield
|
||||||
WebHook.enqueue_hooks(type, "#{type}_destroyed".to_sym,
|
WebHook.enqueue_hooks(type, "#{type}_destroyed".to_sym,
|
||||||
id: id,
|
id: id,
|
||||||
payload: payload
|
payload: payload
|
||||||
)
|
)
|
||||||
|
else
|
||||||
|
yield
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue