A platform for community discussion. Free, open, simple.
DEV: Reserve webhook event types to be used in plugins (#9110)
Blake Erickson43b54c631d08
diff --git a/app/models/web_hook_event_type.rb b/app/models/web_hook_event_type.rbindex 719ceaa712e..c40c7a21a90 100644--- a/app/models/web_hook_event_type.rb+++ b/app/models/web_hook_event_type.rb@@ -11,6 +11,8 @@ class WebHookEventType < ActiveRecord::BaseQUEUED_POST = 8REVIEWABLE = 9NOTIFICATION = 10+ SOLVED = 11+ ASSIGN = 12has_and_belongs_to_many :web_hooksdiff --git a/db/fixtures/007_web_hook_event_types.rb b/db/fixtures/007_web_hook_event_types.rbindex 0645cfad8e5..5cbcd3edc2a 100644--- a/db/fixtures/007_web_hook_event_types.rb+++ b/db/fixtures/007_web_hook_event_types.rb@@ -49,3 +49,13 @@ WebHookEventType.seed do |b|b.id = WebHookEventType::NOTIFICATIONb.name = "notification"end++WebHookEventType.seed do |b|+ b.id = WebHookEventType::SOLVED+ b.name = "solved"+end++WebHookEventType.seed do |b|+ b.id = WebHookEventType::ASSIGN+ b.name = "assign"+enddiff --git a/spec/jobs/emit_web_hook_event_spec.rb b/spec/jobs/emit_web_hook_event_spec.rbindex e87d6b7c7c4..453db11abb2 100644--- a/spec/jobs/emit_web_hook_event_spec.rb+++ b/spec/jobs/emit_web_hook_event_spec.rb@@ -239,17 +239,16 @@ describe Jobs::EmitWebHookEvent dostub_request(:post, post_hook.payload_url).to_return(body: 'OK', status: 200)- WebHookEventType.all.pluck(:name).each do |name|- web_hook_id = Fabricate("#{name}_web_hook").id+ topic_event_type = WebHookEventType.all.first+ web_hook_id = Fabricate("#{topic_event_type.name}_web_hook").id- expect do- subject.execute(- web_hook_id: web_hook_id,- event_type: name,- payload: { test: "some payload" }.to_json- )- end.to change(WebHookEvent, :count).by(1)- end+ expect do+ subject.execute(+ web_hook_id: web_hook_id,+ event_type: topic_event_type.name,+ payload: { test: "some payload" }.to_json+ )+ end.to change(WebHookEvent, :count).by(1)endit 'sets up proper request headers' do