FEATURE: Allow easier customization to the web hook event serialization.

This commit is contained in:
Erick Guan
2016-12-22 17:08:35 +01:00
committed by Guo Xiang Tan
parent bbc85e1e29
commit cfbfea0596
8 changed files with 112 additions and 70 deletions

View File

@ -41,11 +41,11 @@ class WebHook < ActiveRecord::Base
end
def self.enqueue_topic_hooks(event, topic, user=nil)
WebHook.enqueue_hooks(:topic, topic_id: topic.id, user_id: user&.id, category_id: topic&.category_id, event_name: event.to_s)
WebHook.enqueue_hooks(:topic, topic_id: topic.id, category_id: topic&.category_id, event_name: event.to_s)
end
def self.enqueue_post_hooks(event, post, user=nil)
WebHook.enqueue_hooks(:post, post_id: post.id, topic_id: post&.topic_id, user_id: user&.id, category_id: post&.topic&.category_id, event_name: event.to_s)
WebHook.enqueue_hooks(:post, post_id: post.id, category_id: post&.topic&.category_id, event_name: event.to_s)
end
%i(topic_destroyed topic_recovered).each do |event|