Better text spoilers

Remove spoiler content from plaintext body
Don't bridge embeds if their link is spoilered (deliberately imprecise)
This commit is contained in:
Cadence Ember
2026-01-13 22:19:54 +13:00
parent 3d3671e05a
commit 536ab56048
5 changed files with 60 additions and 26 deletions
@@ -862,6 +862,20 @@ test("message2event: advanced written @mentions for matrix users", async t => {
t.equal(called, 1, "should only look up the member list once")
})
test("message2event: spoilers are removed from plaintext body", async t => {
const events = await messageToEvent({
content: "||**beatrice**||"
})
t.deepEqual(events, [{
$type: "m.room.message",
"m.mentions": {},
msgtype: "m.text",
body: "[spoiler]",
format: "org.matrix.custom.html",
formatted_body: `<span data-mx-spoiler=""><strong>beatrice</strong></span>`
}])
})
test("message2event: very large attachment is linked instead of being uploaded", async t => {
const events = await messageToEvent({
content: "hey",