Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

FIX: correctly supports unicode mentions #1198

Merged
merged 1 commit into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/models/chat_message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def self.uncooked
inlineEmoji
html-img
mentions
unicodeUsernames
onebox
quotes
spoiler-alert
Expand Down
11 changes: 11 additions & 0 deletions spec/models/chat_message_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,17 @@
)
end
end

context "unicode usernames are enabled" do
before { SiteSetting.unicode_usernames = true }

it "cooks unicode mentions" do
user = Fabricate(:unicode_user)
cooked = ChatMessage.cook("<h1>@#{user.username}</h1>")

expect(cooked).to eq("<p>&lt;h1&gt;@#{user.username}&lt;/h1&gt;</p>")
end
end
end

describe ".to_markdown" do
Expand Down