From ecebff50609b2bfe4bd3ed2f3de912cddcc240b5 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 10 Jun 2019 16:22:51 -0400 Subject: [PATCH] Only show deprecation warning if the webhook is active --- app/models/web_hook.rb | 8 ++++---- config/initializers/012-web_hook_events.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/web_hook.rb b/app/models/web_hook.rb index c9cf902bb70..ac36d641d07 100644 --- a/app/models/web_hook.rb +++ b/app/models/web_hook.rb @@ -58,11 +58,11 @@ class WebHook < ActiveRecord::Base end def self.enqueue_object_hooks(type, object, event, serializer = nil) - if type == :flag - Discourse.deprecate("The flags webhook is deprecated. Please use reviewable instead.") - end - if active_web_hooks(type).exists? + if type == :flag + Discourse.deprecate("The flags webhook is deprecated. Please use reviewable instead.") + end + payload = WebHook.generate_payload(type, object, serializer) WebHook.enqueue_hooks(type, event, diff --git a/config/initializers/012-web_hook_events.rb b/config/initializers/012-web_hook_events.rb index 5df4c8df031..1451a5ddeea 100644 --- a/config/initializers/012-web_hook_events.rb +++ b/config/initializers/012-web_hook_events.rb @@ -97,7 +97,7 @@ end DiscourseEvent.on(:reviewable_transitioned_to) do |status, reviewable| 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.approved? WebHook.enqueue_object_hooks(:queued_post, reviewable, :approved_post, QueuedPostSerializer)