2018-05-21 04:23:09 -04:00
|
|
|
%i(
|
|
|
|
topic_recovered
|
|
|
|
).each do |event|
|
|
|
|
DiscourseEvent.on(event) do |topic, _|
|
|
|
|
WebHook.enqueue_topic_hooks(event, topic)
|
2017-04-11 21:50:03 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-02-26 22:07:37 -05:00
|
|
|
DiscourseEvent.on(:topic_status_updated) do |topic, status|
|
|
|
|
WebHook.enqueue_topic_hooks("topic_#{status}_status_updated", topic)
|
|
|
|
end
|
|
|
|
|
2018-05-21 04:23:09 -04:00
|
|
|
DiscourseEvent.on(:topic_created) do |topic, _, _|
|
|
|
|
WebHook.enqueue_topic_hooks(:topic_created, topic)
|
2017-04-11 21:50:03 -04:00
|
|
|
end
|
|
|
|
|
2018-05-21 04:23:09 -04:00
|
|
|
%i(
|
|
|
|
post_created
|
|
|
|
post_recovered
|
|
|
|
).each do |event|
|
|
|
|
DiscourseEvent.on(event) do |post, _, _|
|
|
|
|
WebHook.enqueue_post_hooks(event, post)
|
2017-04-11 21:50:03 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
DiscourseEvent.on(:post_edited) do |post, topic_changed|
|
2018-01-22 14:58:01 -05: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-11 21:50:03 -04:00
|
|
|
end
|
|
|
|
|
2017-12-20 04:47:30 -05:00
|
|
|
%i(
|
|
|
|
user_logged_out
|
|
|
|
user_created
|
|
|
|
user_logged_in
|
|
|
|
user_approved
|
|
|
|
user_updated
|
|
|
|
).each do |event|
|
2017-04-11 21:50:03 -04:00
|
|
|
DiscourseEvent.on(event) do |user|
|
2018-05-21 04:23:09 -04:00
|
|
|
WebHook.enqueue_object_hooks(:user, user, event)
|
2017-04-11 21:50:03 -04:00
|
|
|
end
|
|
|
|
end
|
2018-03-27 02:23:35 -04:00
|
|
|
|
|
|
|
%i(
|
|
|
|
group_created
|
|
|
|
group_updated
|
|
|
|
).each do |event|
|
|
|
|
DiscourseEvent.on(event) do |group|
|
2018-05-21 04:23:09 -04:00
|
|
|
WebHook.enqueue_object_hooks(:group, group, event)
|
2018-03-27 02:23:35 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
%i(
|
|
|
|
category_created
|
|
|
|
category_updated
|
|
|
|
).each do |event|
|
|
|
|
DiscourseEvent.on(event) do |category|
|
2018-05-21 04:23:09 -04:00
|
|
|
WebHook.enqueue_object_hooks(:category, category, event)
|
2018-03-27 02:23:35 -04:00
|
|
|
end
|
|
|
|
end
|
2018-04-04 08:19:20 -04:00
|
|
|
|
|
|
|
%i(
|
|
|
|
tag_created
|
|
|
|
tag_updated
|
|
|
|
).each do |event|
|
|
|
|
DiscourseEvent.on(event) do |tag|
|
2018-05-21 05:29:19 -04:00
|
|
|
WebHook.enqueue_object_hooks(:tag, tag, event, TagSerializer)
|
2018-04-04 08:19:20 -04:00
|
|
|
end
|
|
|
|
end
|
2018-04-11 10:17:05 -04:00
|
|
|
|
|
|
|
%i(
|
|
|
|
flag_created
|
|
|
|
flag_agreed
|
|
|
|
flag_disagreed
|
|
|
|
flag_deferred
|
|
|
|
).each do |event|
|
|
|
|
DiscourseEvent.on(event) do |flag|
|
2018-05-21 05:29:19 -04:00
|
|
|
WebHook.enqueue_object_hooks(:flag, flag, event)
|
2018-04-11 10:17:05 -04:00
|
|
|
end
|
|
|
|
end
|
2018-07-25 13:54:43 -04:00
|
|
|
|
|
|
|
%i(
|
2018-07-26 00:59:38 -04:00
|
|
|
queued_post_created
|
2018-07-25 13:54:43 -04:00
|
|
|
approved_post
|
|
|
|
rejected_post
|
|
|
|
).each do |event|
|
|
|
|
DiscourseEvent.on(event) do |queued_post|
|
2018-07-26 00:59:38 -04:00
|
|
|
WebHook.enqueue_object_hooks(:queued_post, queued_post, event, QueuedPostSerializer)
|
2018-07-25 13:54:43 -04:00
|
|
|
end
|
|
|
|
end
|