A platform for community discussion. Free, open, simple.
DEV: Update webhook site setting for topic voting (#27935)
Natalie Tay7d02b453048c
diff --git a/app/models/web_hook_event_type.rb b/app/models/web_hook_event_type.rbindex 9e8303c427a..f4120e7cab9 100644--- a/app/models/web_hook_event_type.rb+++ b/app/models/web_hook_event_type.rb@@ -103,7 +103,7 @@ class WebHookEventType < ActiveRecord::Baseunless defined?(SiteSetting.assign_enabled) && SiteSetting.assign_enabledids_to_exclude.concat([TYPES[:assign_assigned], TYPES[:assign_unassigned]])end- unless defined?(SiteSetting.voting_enabled) && SiteSetting.voting_enabled+ unless defined?(SiteSetting.topic_voting_enabled) && SiteSetting.topic_voting_enabledids_to_exclude.concat([TYPES[:voting_topic_upvote], TYPES[:voting_topic_unvote]])endunless defined?(SiteSetting.chat_enabled) && SiteSetting.chat_enableddiff --git a/spec/models/web_hook_event_type_spec.rb b/spec/models/web_hook_event_type_spec.rbindex 003d48bbbe7..471f67bd449 100644--- a/spec/models/web_hook_event_type_spec.rb+++ b/spec/models/web_hook_event_type_spec.rb@@ -4,7 +4,7 @@ RSpec.describe WebHookEventType dodescribe "#active" doit "returns only active types" docore_event_types = WebHookEventType.active.map(&:name)- expect(core_event_types).to eq(+ expect(core_event_types).to match_array(%w[topic_createdtopic_revised@@ -47,10 +47,10 @@ RSpec.describe WebHookEventType doSiteSetting.stubs(:solved_enabled).returns(true)SiteSetting.stubs(:assign_enabled).returns(true)- SiteSetting.stubs(:voting_enabled).returns(true)+ SiteSetting.stubs(:topic_voting_enabled).returns(true)SiteSetting.stubs(:chat_enabled).returns(true)plugins_event_types = WebHookEventType.active.map(&:name) - core_event_types- expect(plugins_event_types).to eq(+ expect(plugins_event_types).to match_array(%w[accepted_solutionunaccepted_solutiondiff --git a/spec/models/web_hook_spec.rb b/spec/models/web_hook_spec.rbindex 67a9ef09262..5e631c8edcc 100644--- a/spec/models/web_hook_spec.rb+++ b/spec/models/web_hook_spec.rb@@ -57,7 +57,7 @@ RSpec.describe WebHook doassign_event_types = WebHookEventType.active.where(group: "assign").pluck(:name)expect(assign_event_types).to eq(%w[assigned unassigned])- SiteSetting.stubs(:voting_enabled).returns(true)+ SiteSetting.stubs(:topic_voting_enabled).returns(true)voting_event_types = WebHookEventType.active.where(group: "voting").pluck(:name)expect(voting_event_types).to eq(%w[topic_upvote topic_unvote])#