2021-01-11 15:58:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Jobs
|
|
|
|
class PostUpdateTopicTrackingState < ::Jobs::Base
|
|
|
|
|
|
|
|
def execute(args)
|
|
|
|
post = Post.find_by(id: args[:post_id])
|
|
|
|
|
2021-02-09 00:41:22 -05:00
|
|
|
if post && post.topic
|
2021-01-11 15:58:27 -05:00
|
|
|
TopicTrackingState.publish_unmuted(post.topic)
|
|
|
|
if post.post_number > 1
|
|
|
|
TopicTrackingState.publish_muted(post.topic)
|
|
|
|
TopicTrackingState.publish_unread(post)
|
|
|
|
end
|
|
|
|
TopicTrackingState.publish_latest(post.topic, post.whisper?)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|