mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 11:58:33 +08:00
FEATURE: granular webhooks (#23070)
Before this change, webhooks could be only configured for specific groups like for example, all topic events. We would like to have more granular control like for example topic_created or topic_destroyed. Test are failing because plugins changed has to be merged as well: discourse/discourse-assign#498 discourse/discourse-solved#248 discourse/discourse-topic-voting#159
This commit is contained in:

committed by
GitHub

parent
1d3b2d6bd4
commit
c468110929
@ -60,9 +60,11 @@ class PostDestroyer
|
||||
end
|
||||
|
||||
def destroy
|
||||
payload = WebHook.generate_payload(:post, @post) if WebHook.active_web_hooks(:post).exists?
|
||||
payload = WebHook.generate_payload(:post, @post) if WebHook.active_web_hooks(
|
||||
:post_destroyed,
|
||||
).exists?
|
||||
is_first_post = @post.is_first_post? && @topic
|
||||
has_topic_web_hooks = is_first_post && WebHook.active_web_hooks(:topic).exists?
|
||||
has_topic_web_hooks = is_first_post && WebHook.active_web_hooks(:topic_destroyed).exists?
|
||||
|
||||
if has_topic_web_hooks
|
||||
topic_view = TopicView.new(@topic.id, Discourse.system_user, skip_staff_action: true)
|
||||
|
Reference in New Issue
Block a user