mirror of
https://github.com/discourse/discourse.git
synced 2025-09-11 21:04:42 +08:00
FEATURE: automatically sync "move to inbox" / "archive" state on messages
This commit is contained in:
parent
d456150bb2
commit
b0567f9c62
6 changed files with 48 additions and 12 deletions
|
@ -276,8 +276,13 @@ class PostCreator
|
|||
def unarchive_message
|
||||
return unless @topic.private_message? && @topic.id
|
||||
|
||||
UserArchivedMessage.where(topic_id: @topic.id).destroy_all
|
||||
GroupArchivedMessage.where(topic_id: @topic.id).destroy_all
|
||||
UserArchivedMessage.where(topic_id: @topic.id).pluck(:user_id).each do |user_id|
|
||||
UserArchivedMessage.move_to_inbox!(user_id, @topic.id)
|
||||
end
|
||||
|
||||
GroupArchivedMessage.where(topic_id: @topic.id).pluck(:group_id).each do |group_id|
|
||||
GroupArchivedMessage.move_to_inbox!(group_id, @topic.id)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue