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:
parent
2c0b36cb72
commit
8e9a8472f4
2 changed files with 27 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue