mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-10-19 12:46:30 +09:00
Quote a mention as text when replying
Replying swaps each mention in the quoted copy for its text. Assigning that text to outerHTML parsed it as html; replace the mention with a text node instead.
This commit is contained in:
1 parent
7ea05e18f8
commit
6052b123d5
2 files changed
+15
-1
No files matched your search
@@ -28,7 +28,7 @@ export default class extends Controller {
|
||||
}
|
||||
|
||||
#stripMentionAttachments(node) {
|
||||
node.querySelectorAll(".mention").forEach(mention => mention.outerHTML = mention.textContent.trim())
|
||||
node.querySelectorAll(".mention").forEach(mention => mention.replaceWith(mention.textContent.trim()))
|
||||
return node
|
||||
}
|
||||
|
||||
|
||||
@@ -174,6 +174,20 @@ class ComposerTest < ApplicationSystemTestCase
|
||||
assert_selector last_message_selector("cite"), text: "JZ"
|
||||
end
|
||||
|
||||
test "replying quotes a mention's text as text" do
|
||||
message = rooms(:designers).messages.create! creator: users(:kevin), client_message_id: "reply-mention",
|
||||
body: %(<div><span class="mention"><em>Kevin</em></span> says hi</div>)
|
||||
join_room rooms(:designers)
|
||||
|
||||
within_message message do
|
||||
reveal_message_actions
|
||||
find("[aria-label='Reply']").click
|
||||
end
|
||||
|
||||
assert_composer_text "<em>Kevin</em> says hi"
|
||||
assert_no_selector "#composer lexxy-editor em"
|
||||
end
|
||||
|
||||
test "arrow up edits my last message when the composer is empty" do
|
||||
composer_editor.click
|
||||
press_in_composer :up
|
||||
|
||||
Reference in new issue
Block a user