DEV: correct a relationship – a chat message may have several mentions (#20219)

This change only makes the model reflect correctly what's 
already happening in the database. Note that there are no calls 
to chat_message.chat_mention in Core and plugins so this 
change should be safe.

Also note, that at the moment we use the chat_mentions db 
table only to support notifications about mentions, but 
we're going to start using it for other cases. This commit is 
the first step in that direction.
This commit is contained in:
Andrei Prigorshnev
2023-02-09 17:44:04 +04:00
committed by GitHub
parent 45412206f7
commit 0dcfd7ddec
2 changed files with 3 additions and 1 deletions

View File

@ -5,6 +5,8 @@ require "rails_helper"
describe ChatMessage do
fab!(:message) { Fabricate(:chat_message, message: "hey friend, what's up?!") }
it { is_expected.to have_many(:chat_mentions).dependent(:destroy) }
describe ".cook" do
it "does not support HTML tags" do
cooked = ChatMessage.cook("<h1>test</h1>")