FIX: Delete associated notifications when trashing chat messages. (#20144)

Deleting a message with a mention doesn't clear the associated notification, confusing the mentioned user.

There are different chat notification types, but we only care about `chat_mentioned` since `chat_quoted` is associated with a post, and `chat_message` is only for push notifications.

Unfortunately, this change doesn't fix the chat bubble getting out of sync when a message gets deleted since we track unread/mentions count with an integer, making it a bit hard to manipulate. We can follow up later if we consider it necessary.
This commit is contained in:
Roman Rizzi
2023-02-03 12:52:13 -03:00
committed by GitHub
parent 44df5ee7c8
commit 082cd13909
5 changed files with 61 additions and 9 deletions

View File

@ -611,7 +611,7 @@ RSpec.describe Chat::ChatController do
end
before do
ChatMessage.create(user: user, message: "this is a message", chat_channel: chat_channel)
ChatMessage.create!(user: user, message: "this is a message", chat_channel: chat_channel)
end
describe "for category" do