Only show deprecation warning if the webhook is active
This commit is contained in:
parent
ace6ce0462
commit
ecebff5060
|
@ -58,11 +58,11 @@ class WebHook < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.enqueue_object_hooks(type, object, event, serializer = nil)
|
def self.enqueue_object_hooks(type, object, event, serializer = nil)
|
||||||
|
if active_web_hooks(type).exists?
|
||||||
if type == :flag
|
if type == :flag
|
||||||
Discourse.deprecate("The flags webhook is deprecated. Please use reviewable instead.")
|
Discourse.deprecate("The flags webhook is deprecated. Please use reviewable instead.")
|
||||||
end
|
end
|
||||||
|
|
||||||
if active_web_hooks(type).exists?
|
|
||||||
payload = WebHook.generate_payload(type, object, serializer)
|
payload = WebHook.generate_payload(type, object, serializer)
|
||||||
|
|
||||||
WebHook.enqueue_hooks(type, event,
|
WebHook.enqueue_hooks(type, event,
|
||||||
|
|
|
@ -97,7 +97,7 @@ end
|
||||||
DiscourseEvent.on(:reviewable_transitioned_to) do |status, reviewable|
|
DiscourseEvent.on(:reviewable_transitioned_to) do |status, reviewable|
|
||||||
WebHook.enqueue_object_hooks(:reviewable, reviewable, :reviewable_transitioned_to, reviewable.serializer)
|
WebHook.enqueue_object_hooks(:reviewable, reviewable, :reviewable_transitioned_to, reviewable.serializer)
|
||||||
|
|
||||||
# TODO: Backwards compatibility for Queued Post webhooks. Remve in favor of Reviewable API
|
# TODO: Backwards compatibility for Queued Post webhooks. Remove in favor of Reviewable API
|
||||||
if reviewable.is_a?(ReviewableQueuedPost)
|
if reviewable.is_a?(ReviewableQueuedPost)
|
||||||
if reviewable.approved?
|
if reviewable.approved?
|
||||||
WebHook.enqueue_object_hooks(:queued_post, reviewable, :approved_post, QueuedPostSerializer)
|
WebHook.enqueue_object_hooks(:queued_post, reviewable, :approved_post, QueuedPostSerializer)
|
||||||
|
|
Loading…
Reference in New Issue