mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 00:38:04 +08:00
DEV: Always create chat mention records (#20470)
Before this commit, we created a chat mention record only in case we wanted to send a notification about that mention to the user. Notifications were the only use case for the chat_mention db table. Now we want to use that table for other features, so we have to always create a chat_mention record.
This commit is contained in:

committed by
GitHub

parent
1f88354c5e
commit
fa543cda06
@ -139,7 +139,18 @@ RSpec.describe Chat::ChatMessageMentions do
|
||||
end
|
||||
|
||||
it "returns an empty list if no group was mentioned" do
|
||||
message = create_message("not mentioning anybody")
|
||||
message = create_message("not mentioning anyone")
|
||||
|
||||
mentions = Chat::ChatMessageMentions.new(message)
|
||||
result = mentions.group_mentions.pluck(:username)
|
||||
|
||||
expect(result).to be_empty
|
||||
end
|
||||
|
||||
it "returns an empty list when mentioning an unmentionable group" do
|
||||
group1.mentionable_level = Group::ALIAS_LEVELS[:nobody]
|
||||
group1.save!
|
||||
message = create_message("mentioning @#{group1.name}")
|
||||
|
||||
mentions = Chat::ChatMessageMentions.new(message)
|
||||
result = mentions.group_mentions.pluck(:username)
|
||||
|
Reference in New Issue
Block a user