2017-04-11 20:50:03 -05:00
|
|
|
%i(topic_destroyed topic_recovered).each do |event|
|
|
|
|
DiscourseEvent.on(event) do |topic, user|
|
|
|
|
WebHook.enqueue_topic_hooks(event, topic, user)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-02-26 21:07:37 -06:00
|
|
|
DiscourseEvent.on(:topic_status_updated) do |topic, status|
|
|
|
|
WebHook.enqueue_topic_hooks("topic_#{status}_status_updated", topic)
|
|
|
|
end
|
|
|
|
|
2017-04-11 20:50:03 -05:00
|
|
|
DiscourseEvent.on(:topic_created) do |topic, _, user|
|
|
|
|
WebHook.enqueue_topic_hooks(:topic_created, topic, user)
|
|
|
|
end
|
|
|
|
|
|
|
|
%i(post_created
|
|
|
|
post_destroyed
|
|
|
|
post_recovered).each do |event|
|
|
|
|
|
|
|
|
DiscourseEvent.on(event) do |post, _, user|
|
|
|
|
WebHook.enqueue_post_hooks(event, post, user)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
DiscourseEvent.on(:post_edited) do |post, topic_changed|
|
2018-01-22 13:58:01 -06: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 20:50:03 -05:00
|
|
|
end
|
|
|
|
|
2017-12-20 03:47:30 -06:00
|
|
|
%i(
|
|
|
|
user_logged_out
|
|
|
|
user_created
|
|
|
|
user_logged_in
|
|
|
|
user_approved
|
|
|
|
user_updated
|
|
|
|
).each do |event|
|
2017-04-11 20:50:03 -05:00
|
|
|
DiscourseEvent.on(event) do |user|
|
|
|
|
WebHook.enqueue_hooks(:user, user_id: user.id, event_name: event.to_s)
|
|
|
|
end
|
|
|
|
end
|
2018-03-27 01:23:35 -05:00
|
|
|
|
|
|
|
%i(
|
|
|
|
group_created
|
|
|
|
group_updated
|
|
|
|
group_destroyed
|
|
|
|
).each do |event|
|
|
|
|
DiscourseEvent.on(event) do |group|
|
|
|
|
WebHook.enqueue_hooks(:group, group_id: group.id, event_name: event.to_s)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
%i(
|
|
|
|
category_created
|
|
|
|
category_updated
|
|
|
|
category_destroyed
|
|
|
|
).each do |event|
|
|
|
|
DiscourseEvent.on(event) do |category|
|
|
|
|
WebHook.enqueue_hooks(:category, category_id: category.id, event_name: event.to_s)
|
|
|
|
end
|
|
|
|
end
|