FEATURE: Added Category Experts unapproved post WebHook Event (#28802)

This PR is adding a Category Experts unapproved WebHook event type.
This commit is contained in:
Guhyoun Nam 2024-09-10 07:56:35 +09:00 committed by GitHub
parent a7db66e8ab
commit aacd354de5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 1 deletions

View File

@ -41,6 +41,7 @@ class WebHook < ActiveRecord::Base
WebHookEventType::TYPES[:post_destroyed], WebHookEventType::TYPES[:post_destroyed],
WebHookEventType::TYPES[:post_recovered], WebHookEventType::TYPES[:post_recovered],
WebHookEventType::TYPES[:category_experts_approved], WebHookEventType::TYPES[:category_experts_approved],
WebHookEventType::TYPES[:category_experts_unapproved],
], ],
) )
end end

View File

@ -86,6 +86,7 @@ class WebHookEventType < ActiveRecord::Base
chat_message_trashed: 1803, chat_message_trashed: 1803,
chat_message_restored: 1804, chat_message_restored: 1804,
category_experts_approved: 1901, category_experts_approved: 1901,
category_experts_unapproved: 1902,
} }
has_and_belongs_to_many :web_hooks has_and_belongs_to_many :web_hooks
@ -118,7 +119,9 @@ class WebHookEventType < ActiveRecord::Base
) )
end end
unless defined?(SiteSetting.enable_category_experts) && SiteSetting.enable_category_experts 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 end
self.where.not(id: ids_to_exclude) self.where.not(id: ids_to_exclude)
end end

View File

@ -5411,6 +5411,7 @@ en:
post_destroyed: "Post is deleted" post_destroyed: "Post is deleted"
post_recovered: "Post is recovered" post_recovered: "Post is recovered"
category_experts_approved: "Post marked as category experts post" category_experts_approved: "Post marked as category experts post"
category_experts_unapproved: "Post unmarked as category experts post"
group_event: group_event:
group_name: "Group Events" group_name: "Group Events"
group_created: "Group is created" group_created: "Group is created"

View File

@ -235,3 +235,8 @@ WebHookEventType.seed do |b|
b.name = "category_experts_approved" b.name = "category_experts_approved"
b.group = WebHookEventType.groups[:post] b.group = WebHookEventType.groups[:post]
end end
WebHookEventType.seed do |b|
b.id = WebHookEventType::TYPES[:category_experts_unapproved]
b.name = "category_experts_unapproved"
b.group = WebHookEventType.groups[:post]
end

View File

@ -64,6 +64,7 @@ RSpec.describe WebHookEventType do
chat_message_trashed chat_message_trashed
chat_message_restored chat_message_restored
category_experts_approved category_experts_approved
category_experts_unapproved
], ],
) )
end end