DEV: remove unnecessary safe nav operators (#6730)

This commit is contained in:
Vinoth Kannan 2018-12-05 20:07:18 +05:30 committed by GitHub
parent 97e6e3b133
commit 57ba4b7cb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -66,27 +66,27 @@ class WebHook < ActiveRecord::Base
end
def self.enqueue_topic_hooks(event, topic)
if active_web_hooks('topic').exists?
if active_web_hooks('topic').exists? && topic.present?
topic_view = TopicView.new(topic.id, Discourse.system_user)
payload = WebHook.generate_payload(:topic, topic_view, WebHookTopicViewSerializer)
WebHook.enqueue_hooks(:topic, event,
id: topic.id,
category_id: topic&.category_id,
tag_ids: topic&.tags&.pluck(:id),
category_id: topic.category_id,
tag_ids: topic.tags.pluck(:id),
payload: payload
)
end
end
def self.enqueue_post_hooks(event, post)
if active_web_hooks('post').exists?
if active_web_hooks('post').exists? && post.present?
payload = WebHook.generate_payload(:post, post)
WebHook.enqueue_hooks(:post, event,
id: post.id,
category_id: post&.topic&.category_id,
tag_ids: post&.topic&.tags&.pluck(:id),
category_id: post.topic&.category_id,
tag_ids: post.topic&.tags&.pluck(:id),
payload: payload
)
end