2018-05-21 16:23:09 +08:00
|
|
|
%i(
|
|
|
|
topic_destroyed
|
|
|
|
topic_recovered
|
|
|
|
).each do |event|
|
|
|
|
DiscourseEvent.on(event) do |topic, _|
|
|
|
|
WebHook.enqueue_topic_hooks(event, topic)
|
2017-04-12 09:50:03 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-02-27 11:07:37 +08:00
|
|
|
DiscourseEvent.on(:topic_status_updated) do |topic, status|
|
|
|
|
WebHook.enqueue_topic_hooks("topic_#{status}_status_updated", topic)
|
|
|
|
end
|
|
|
|
|
2018-05-21 16:23:09 +08:00
|
|
|
DiscourseEvent.on(:topic_created) do |topic, _, _|
|
|
|
|
WebHook.enqueue_topic_hooks(:topic_created, topic)
|
2017-04-12 09:50:03 +08:00
|
|
|
end
|
|
|
|
|
2018-05-21 16:23:09 +08:00
|
|
|
%i(
|
|
|
|
post_created
|
|
|
|
post_destroyed
|
|
|
|
post_recovered
|
|
|
|
).each do |event|
|
|
|
|
DiscourseEvent.on(event) do |post, _, _|
|
|
|
|
WebHook.enqueue_post_hooks(event, post)
|
2017-04-12 09:50:03 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
DiscourseEvent.on(:post_edited) do |post, topic_changed|
|
2018-01-23 03:58:01 +08:00
|
|
|
if post.topic
|
|
|
|
WebHook.enqueue_post_hooks(:post_edited, post)
|
|
|
|
|
|
|
|
if post.is_first_post? && topic_changed
|
|
|
|
WebHook.enqueue_topic_hooks(:topic_edited, post.topic)
|
|
|
|
end
|
|
|
|
end
|
2017-04-12 09:50:03 +08:00
|
|
|
end
|
|
|
|
|
2017-12-20 17:47:30 +08:00
|
|
|
%i(
|
|
|
|
user_logged_out
|
|
|
|
user_created
|
|
|
|
user_logged_in
|
|
|
|
user_approved
|
|
|
|
user_updated
|
2018-07-23 15:49:49 +08:00
|
|
|
user_destroyed
|
2017-12-20 17:47:30 +08:00
|
|
|
).each do |event|
|
2017-04-12 09:50:03 +08:00
|
|
|
DiscourseEvent.on(event) do |user|
|
2018-05-21 16:23:09 +08:00
|
|
|
WebHook.enqueue_object_hooks(:user, user, event)
|
2017-04-12 09:50:03 +08:00
|
|
|
end
|
|
|
|
end
|
2018-03-27 14:23:35 +08:00
|
|
|
|
|
|
|
%i(
|
|
|
|
group_created
|
|
|
|
group_updated
|
|
|
|
group_destroyed
|
|
|
|
).each do |event|
|
|
|
|
DiscourseEvent.on(event) do |group|
|
2018-05-21 16:23:09 +08:00
|
|
|
WebHook.enqueue_object_hooks(:group, group, event)
|
2018-03-27 14:23:35 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
%i(
|
|
|
|
category_created
|
|
|
|
category_updated
|
|
|
|
category_destroyed
|
|
|
|
).each do |event|
|
|
|
|
DiscourseEvent.on(event) do |category|
|
2018-05-21 16:23:09 +08:00
|
|
|
WebHook.enqueue_object_hooks(:category, category, event)
|
2018-03-27 14:23:35 +08:00
|
|
|
end
|
|
|
|
end
|
2018-04-04 20:19:20 +08:00
|
|
|
|
|
|
|
%i(
|
|
|
|
tag_created
|
|
|
|
tag_updated
|
|
|
|
tag_destroyed
|
|
|
|
).each do |event|
|
|
|
|
DiscourseEvent.on(event) do |tag|
|
2018-05-21 17:29:19 +08:00
|
|
|
WebHook.enqueue_object_hooks(:tag, tag, event, TagSerializer)
|
2018-04-04 20:19:20 +08:00
|
|
|
end
|
|
|
|
end
|
2018-04-11 22:17:05 +08:00
|
|
|
|
|
|
|
%i(
|
|
|
|
flag_created
|
|
|
|
flag_agreed
|
|
|
|
flag_disagreed
|
|
|
|
flag_deferred
|
|
|
|
).each do |event|
|
|
|
|
DiscourseEvent.on(event) do |flag|
|
2018-05-21 17:29:19 +08:00
|
|
|
WebHook.enqueue_object_hooks(:flag, flag, event)
|
2018-04-11 22:17:05 +08:00
|
|
|
end
|
|
|
|
end
|
2018-07-26 01:54:43 +08:00
|
|
|
|
|
|
|
%i(
|
2018-07-26 12:59:38 +08:00
|
|
|
queued_post_created
|
2018-07-26 01:54:43 +08:00
|
|
|
approved_post
|
|
|
|
rejected_post
|
|
|
|
).each do |event|
|
|
|
|
DiscourseEvent.on(event) do |queued_post|
|
2018-07-26 12:59:38 +08:00
|
|
|
WebHook.enqueue_object_hooks(:queued_post, queued_post, event, QueuedPostSerializer)
|
2018-07-26 01:54:43 +08:00
|
|
|
end
|
|
|
|
end
|