2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-05 08:59:27 +08:00

FEATURE: don't move muted messages back into inbox

This commit is contained in:
Sam Saffron 2016-02-15 10:56:39 +11:00
parent 2c0b36cb72
commit 8e9a8472f4
2 changed files with 27 additions and 0 deletions

View file

@ -3,6 +3,12 @@ class UserArchivedMessage < ActiveRecord::Base
belongs_to :topic
def self.move_to_inbox!(user_id, topic_id)
return if (TopicUser.where(
user_id: user_id,
topic_id: topic_id,
notification_level: TopicUser.notification_levels[:muted]
).exists?)
UserArchivedMessage.where(user_id: user_id, topic_id: topic_id).destroy_all
MessageBus.publish("/topic/#{topic_id}", {type: "move_to_inbox"}, user_ids: [user_id])
end