mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 18:13:39 +08:00
DEV: Move private message topic tracking state publish into sidekiq.
Same intend as b1f32f2f57
.
This commit is contained in:
parent
543a2d70b2
commit
c51c80466c
|
@ -5,14 +5,21 @@ module Jobs
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
post = Post.find_by(id: args[:post_id])
|
post = Post.find_by(id: args[:post_id])
|
||||||
|
topic = post&.topic
|
||||||
|
return unless topic
|
||||||
|
|
||||||
|
if post.topic.private_message?
|
||||||
|
TopicTrackingState.publish_private_message(topic, post: post)
|
||||||
|
TopicGroup.new_message_update(topic.last_poster, topic.id, post.post_number)
|
||||||
|
else
|
||||||
|
TopicTrackingState.publish_unmuted(topic)
|
||||||
|
|
||||||
if post && post.topic
|
|
||||||
TopicTrackingState.publish_unmuted(post.topic)
|
|
||||||
if post.post_number > 1
|
if post.post_number > 1
|
||||||
TopicTrackingState.publish_muted(post.topic)
|
TopicTrackingState.publish_muted(topic)
|
||||||
TopicTrackingState.publish_unread(post)
|
TopicTrackingState.publish_unread(post)
|
||||||
end
|
end
|
||||||
TopicTrackingState.publish_latest(post.topic, post.whisper?)
|
|
||||||
|
TopicTrackingState.publish_latest(topic, post.whisper?)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,6 @@ class PostJobsEnqueuer
|
||||||
after_topic_create
|
after_topic_create
|
||||||
make_visible
|
make_visible
|
||||||
end
|
end
|
||||||
|
|
||||||
if @topic.private_message?
|
|
||||||
TopicTrackingState.publish_private_message(@topic, post: @post)
|
|
||||||
TopicGroup.new_message_update(@topic.last_poster, @topic.id, @post.post_number)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Reference in New Issue
Block a user