mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Added Category Experts approved WebHook Event (#28525)
This PR is adding a Category Experts WebHook event type.
This commit is contained in:
parent
153175d676
commit
050c665160
@ -17,6 +17,7 @@ class WebHookEventType < ActiveRecord::Base
|
|||||||
USER_PROMOTED = 16
|
USER_PROMOTED = 16
|
||||||
TOPIC_VOTING = 17
|
TOPIC_VOTING = 17
|
||||||
CHAT_MESSAGE = 18
|
CHAT_MESSAGE = 18
|
||||||
|
CATEGORY_EXPERTS = 19
|
||||||
|
|
||||||
enum group: {
|
enum group: {
|
||||||
topic: 0,
|
topic: 0,
|
||||||
@ -35,6 +36,7 @@ class WebHookEventType < ActiveRecord::Base
|
|||||||
user_promoted: 13,
|
user_promoted: 13,
|
||||||
voting: 14,
|
voting: 14,
|
||||||
chat: 15,
|
chat: 15,
|
||||||
|
category_experts: 16,
|
||||||
},
|
},
|
||||||
_scopes: false
|
_scopes: false
|
||||||
|
|
||||||
@ -85,6 +87,7 @@ class WebHookEventType < ActiveRecord::Base
|
|||||||
chat_message_edited: 1802,
|
chat_message_edited: 1802,
|
||||||
chat_message_trashed: 1803,
|
chat_message_trashed: 1803,
|
||||||
chat_message_restored: 1804,
|
chat_message_restored: 1804,
|
||||||
|
category_experts_approved: 1901,
|
||||||
}
|
}
|
||||||
|
|
||||||
has_and_belongs_to_many :web_hooks
|
has_and_belongs_to_many :web_hooks
|
||||||
@ -116,6 +119,9 @@ class WebHookEventType < ActiveRecord::Base
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
unless defined?(SiteSetting.enable_category_experts) && SiteSetting.enable_category_experts
|
||||||
|
ids_to_exclude.concat([TYPES[:category_experts_approved]])
|
||||||
|
end
|
||||||
self.where.not(id: ids_to_exclude)
|
self.where.not(id: ids_to_exclude)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -230,3 +230,8 @@ WebHookEventType.seed do |b|
|
|||||||
b.name = "chat_message_restored"
|
b.name = "chat_message_restored"
|
||||||
b.group = WebHookEventType.groups[:chat]
|
b.group = WebHookEventType.groups[:chat]
|
||||||
end
|
end
|
||||||
|
WebHookEventType.seed do |b|
|
||||||
|
b.id = WebHookEventType::TYPES[:category_experts_approved]
|
||||||
|
b.name = "category_experts_approved"
|
||||||
|
b.group = WebHookEventType.groups[:category_experts]
|
||||||
|
end
|
||||||
|
@ -49,6 +49,7 @@ RSpec.describe WebHookEventType do
|
|||||||
SiteSetting.stubs(:assign_enabled).returns(true)
|
SiteSetting.stubs(:assign_enabled).returns(true)
|
||||||
SiteSetting.stubs(:topic_voting_enabled).returns(true)
|
SiteSetting.stubs(:topic_voting_enabled).returns(true)
|
||||||
SiteSetting.stubs(:chat_enabled).returns(true)
|
SiteSetting.stubs(:chat_enabled).returns(true)
|
||||||
|
SiteSetting.stubs(:enable_category_experts).returns(true)
|
||||||
plugins_event_types = WebHookEventType.active.map(&:name) - core_event_types
|
plugins_event_types = WebHookEventType.active.map(&:name) - core_event_types
|
||||||
expect(plugins_event_types).to match_array(
|
expect(plugins_event_types).to match_array(
|
||||||
%w[
|
%w[
|
||||||
@ -62,6 +63,7 @@ RSpec.describe WebHookEventType do
|
|||||||
chat_message_edited
|
chat_message_edited
|
||||||
chat_message_trashed
|
chat_message_trashed
|
||||||
chat_message_restored
|
chat_message_restored
|
||||||
|
category_experts_approved
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user