mirror of
https://github.com/discourse/discourse.git
synced 2026-08-12 05:55:39 -05:00
FIX: Payload for webhooks should be current as of the time the event was triggered.
https://meta.discourse.org/t/group-category-tag-user-deleted-webhooks-not-firing/87752
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
%i(topic_destroyed topic_recovered).each do |event|
|
||||
DiscourseEvent.on(event) do |topic, user|
|
||||
WebHook.enqueue_topic_hooks(event, topic, user)
|
||||
%i(
|
||||
topic_destroyed
|
||||
topic_recovered
|
||||
).each do |event|
|
||||
DiscourseEvent.on(event) do |topic, _|
|
||||
WebHook.enqueue_topic_hooks(event, topic)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,16 +11,17 @@ DiscourseEvent.on(:topic_status_updated) do |topic, status|
|
||||
WebHook.enqueue_topic_hooks("topic_#{status}_status_updated", topic)
|
||||
end
|
||||
|
||||
DiscourseEvent.on(:topic_created) do |topic, _, user|
|
||||
WebHook.enqueue_topic_hooks(:topic_created, topic, user)
|
||||
DiscourseEvent.on(:topic_created) do |topic, _, _|
|
||||
WebHook.enqueue_topic_hooks(:topic_created, topic)
|
||||
end
|
||||
|
||||
%i(post_created
|
||||
post_destroyed
|
||||
post_recovered).each do |event|
|
||||
|
||||
DiscourseEvent.on(event) do |post, _, user|
|
||||
WebHook.enqueue_post_hooks(event, post, user)
|
||||
%i(
|
||||
post_created
|
||||
post_destroyed
|
||||
post_recovered
|
||||
).each do |event|
|
||||
DiscourseEvent.on(event) do |post, _, _|
|
||||
WebHook.enqueue_post_hooks(event, post)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,7 +43,7 @@ end
|
||||
user_updated
|
||||
).each do |event|
|
||||
DiscourseEvent.on(event) do |user|
|
||||
WebHook.enqueue_hooks(:user, user_id: user.id, event_name: event.to_s)
|
||||
WebHook.enqueue_object_hooks(:user, user, event)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -49,7 +53,7 @@ end
|
||||
group_destroyed
|
||||
).each do |event|
|
||||
DiscourseEvent.on(event) do |group|
|
||||
WebHook.enqueue_hooks(:group, group_id: group.id, event_name: event.to_s)
|
||||
WebHook.enqueue_object_hooks(:group, group, event)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -59,7 +63,7 @@ end
|
||||
category_destroyed
|
||||
).each do |event|
|
||||
DiscourseEvent.on(event) do |category|
|
||||
WebHook.enqueue_hooks(:category, category_id: category.id, event_name: event.to_s)
|
||||
WebHook.enqueue_object_hooks(:category, category, event)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -69,7 +73,7 @@ end
|
||||
tag_destroyed
|
||||
).each do |event|
|
||||
DiscourseEvent.on(event) do |tag|
|
||||
WebHook.enqueue_hooks(:tag, tag_id: tag.id, event_name: event.to_s)
|
||||
WebHook.enqueue_object_hooks(:tag, tag, event)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -80,6 +84,6 @@ end
|
||||
flag_deferred
|
||||
).each do |event|
|
||||
DiscourseEvent.on(event) do |flag|
|
||||
WebHook.enqueue_hooks(:flag, flag_id: flag.id, event_name: event.to_s)
|
||||
WebHook.enqueue_object_hooks(:flag, flag, event, WebHookFlagSerializer)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user