FIX: the muted message should be sent after edit (#9593)

Recently, we added feature that we are sending `/muted` to users who muted specific topic just before `/latest` so the client knows to ignore those messages - https://github.com/discourse/discourse/pull/9482

Same `/muted` message should be included when the post is edited
This commit is contained in:
Krzysztof Kotlarek
2020-05-01 08:33:57 +10:00
committed by GitHub
parent d615de9139
commit 37e93914fc
5 changed files with 24 additions and 10 deletions

View File

@@ -72,8 +72,8 @@ class TopicTrackingState
"/unread/#{user_id}"
end
def self.publish_muted(post)
user_ids = post.topic.topic_users
def self.publish_muted(topic)
user_ids = topic.topic_users
.where(notification_level: NotificationLevels.all[:muted])
.joins(:user)
.where("users.last_seen_at > ?", 7.days.ago)
@@ -82,7 +82,7 @@ class TopicTrackingState
.pluck(:user_id)
return if user_ids.blank?
message = {
topic_id: post.topic_id,
topic_id: topic.id,
message_type: MUTED_MESSAGE_TYPE,
}
MessageBus.publish("/latest", message.as_json, user_ids: user_ids)