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:
parent
45412206f7
commit
0dcfd7ddec
|
@ -22,7 +22,7 @@ class ChatMessage < ActiveRecord::Base
|
|||
# TODO (martin) Remove this when we drop the ChatUpload table
|
||||
has_many :chat_uploads, dependent: :destroy
|
||||
has_one :chat_webhook_event, dependent: :destroy
|
||||
has_one :chat_mention, dependent: :destroy
|
||||
has_many :chat_mentions, dependent: :destroy
|
||||
|
||||
scope :in_public_channel,
|
||||
-> {
|
||||
|
|
|
@ -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>")
|
||||
|
|
Loading…
Reference in New Issue