FIX: User archiving message should also publish to sent section.

This commit is contained in:
Guo Xiang Tan 2018-03-07 11:39:23 +08:00
parent bef35f7be5
commit 5169be6080
2 changed files with 17 additions and 7 deletions

View File

@ -252,14 +252,18 @@ SQL
allowed_user_ids = topic.allowed_users.pluck(:id)
if allowed_user_ids.include?(post&.user_id)
if post && allowed_user_ids.include?(post.user_id)
channels["/private-messages/sent"] = [post.user_id]
end
if user_archive
elsif user_archive
user_ids = [user_id]
channels["/private-messages/archive"] = user_ids
channels["/private-messages/inbox"] = user_ids
[
"/private-messages/archive",
"/private-messages/inbox",
"/private-messages/sent",
].each do |channel|
channels[channel] = user_ids
end
else
topic.allowed_groups.each do |group|
channel = "/private-messages/group/#{group.name.downcase}"

View File

@ -163,7 +163,13 @@ describe TopicTrackingState do
)
end
["/private-messages/archive", "/private-messages/inbox"].each do |channel|
expect(messages.count).to eq(3)
[
"/private-messages/archive",
"/private-messages/inbox",
"/private-messages/sent",
].each do |channel|
message = messages.find do |message|
message.channel = channel
end