From aacd354de58cf6a67c55ece2219f11752d011f73 Mon Sep 17 00:00:00 2001 From: Guhyoun Nam <70915823+rngus2344@users.noreply.github.com> Date: Tue, 10 Sep 2024 07:56:35 +0900 Subject: [PATCH] FEATURE: Added Category Experts unapproved post WebHook Event (#28802) This PR is adding a Category Experts unapproved WebHook event type. --- app/models/web_hook.rb | 1 + app/models/web_hook_event_type.rb | 5 ++++- config/locales/client.en.yml | 1 + db/fixtures/007_web_hook_event_types.rb | 5 +++++ spec/models/web_hook_event_type_spec.rb | 1 + 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/models/web_hook.rb b/app/models/web_hook.rb index 3b003e1f2da..06bae70363a 100644 --- a/app/models/web_hook.rb +++ b/app/models/web_hook.rb @@ -41,6 +41,7 @@ class WebHook < ActiveRecord::Base WebHookEventType::TYPES[:post_destroyed], WebHookEventType::TYPES[:post_recovered], WebHookEventType::TYPES[:category_experts_approved], + WebHookEventType::TYPES[:category_experts_unapproved], ], ) end diff --git a/app/models/web_hook_event_type.rb b/app/models/web_hook_event_type.rb index a5a66120598..5f4c57fc676 100644 --- a/app/models/web_hook_event_type.rb +++ b/app/models/web_hook_event_type.rb @@ -86,6 +86,7 @@ class WebHookEventType < ActiveRecord::Base chat_message_trashed: 1803, chat_message_restored: 1804, category_experts_approved: 1901, + category_experts_unapproved: 1902, } has_and_belongs_to_many :web_hooks @@ -118,7 +119,9 @@ class WebHookEventType < ActiveRecord::Base ) end unless defined?(SiteSetting.enable_category_experts) && SiteSetting.enable_category_experts - ids_to_exclude.concat([TYPES[:category_experts_approved]]) + ids_to_exclude.concat( + [TYPES[:category_experts_approved], TYPES[:category_experts_unapproved]], + ) end self.where.not(id: ids_to_exclude) end diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 99fb31f5e8e..2217bd4e74a 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -5411,6 +5411,7 @@ en: post_destroyed: "Post is deleted" post_recovered: "Post is recovered" category_experts_approved: "Post marked as category experts post" + category_experts_unapproved: "Post unmarked as category experts post" group_event: group_name: "Group Events" group_created: "Group is created" diff --git a/db/fixtures/007_web_hook_event_types.rb b/db/fixtures/007_web_hook_event_types.rb index 61f6807a0d5..6f619eaee93 100644 --- a/db/fixtures/007_web_hook_event_types.rb +++ b/db/fixtures/007_web_hook_event_types.rb @@ -235,3 +235,8 @@ WebHookEventType.seed do |b| b.name = "category_experts_approved" b.group = WebHookEventType.groups[:post] end +WebHookEventType.seed do |b| + b.id = WebHookEventType::TYPES[:category_experts_unapproved] + b.name = "category_experts_unapproved" + b.group = WebHookEventType.groups[:post] +end diff --git a/spec/models/web_hook_event_type_spec.rb b/spec/models/web_hook_event_type_spec.rb index f3855a05b23..32821cec352 100644 --- a/spec/models/web_hook_event_type_spec.rb +++ b/spec/models/web_hook_event_type_spec.rb @@ -64,6 +64,7 @@ RSpec.describe WebHookEventType do chat_message_trashed chat_message_restored category_experts_approved + category_experts_unapproved ], ) end