FIX: No need to fetch the model.

This commit is contained in:
Guo Xiang Tan 2016-12-02 17:17:03 +08:00
parent 3971f96aa6
commit e51574bea0
1 changed files with 2 additions and 2 deletions

View File

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