DEV: remove unnecessary safe nav operators (#6730)
This commit is contained in:
parent
97e6e3b133
commit
57ba4b7cb2
|
@ -66,27 +66,27 @@ class WebHook < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.enqueue_topic_hooks(event, topic)
|
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)
|
topic_view = TopicView.new(topic.id, Discourse.system_user)
|
||||||
payload = WebHook.generate_payload(:topic, topic_view, WebHookTopicViewSerializer)
|
payload = WebHook.generate_payload(:topic, topic_view, WebHookTopicViewSerializer)
|
||||||
|
|
||||||
WebHook.enqueue_hooks(:topic, event,
|
WebHook.enqueue_hooks(:topic, event,
|
||||||
id: topic.id,
|
id: topic.id,
|
||||||
category_id: topic&.category_id,
|
category_id: topic.category_id,
|
||||||
tag_ids: topic&.tags&.pluck(:id),
|
tag_ids: topic.tags.pluck(:id),
|
||||||
payload: payload
|
payload: payload
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.enqueue_post_hooks(event, post)
|
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)
|
payload = WebHook.generate_payload(:post, post)
|
||||||
|
|
||||||
WebHook.enqueue_hooks(:post, event,
|
WebHook.enqueue_hooks(:post, event,
|
||||||
id: post.id,
|
id: post.id,
|
||||||
category_id: post&.topic&.category_id,
|
category_id: post.topic&.category_id,
|
||||||
tag_ids: post&.topic&.tags&.pluck(:id),
|
tag_ids: post.topic&.tags&.pluck(:id),
|
||||||
payload: payload
|
payload: payload
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue