Consistently add @ to m->d matrix mentions

This commit is contained in:
Cadence Ember 2024-07-31 00:06:32 +12:00
parent f9eb043c10
commit 2c3b653b54
2 changed files with 2 additions and 2 deletions

View file

@ -129,7 +129,7 @@ turndownService.addRule("inlineLink", {
const href = node.getAttribute("href")
content = content.replace(/ @.*/, "")
if (href === content) return href
if (href.startsWith("https://matrix.to/#/@") && content[0] !== "@") content = "@" + content
if (decodeURIComponent(href).startsWith("https://matrix.to/#/@") && content[0] !== "@") content = "@" + content
return "[" + content + "](" + href + ")"
}
})

View file

@ -292,7 +292,7 @@ test("event2message: markdown in link text does not attempt to be escaped becaus
messagesToEdit: [],
messagesToSend: [{
username: "cadence [they]",
content: "hey [mario sports mix [she/her]](<https://matrix.to/#/%40cadence%3Acadence.moe>), is it possible to listen on a unix socket?",
content: "hey [@mario sports mix [she/her]](<https://matrix.to/#/%40cadence%3Acadence.moe>), is it possible to listen on a unix socket?",
avatar_url: undefined,
allowed_mentions: {
parse: ["users", "roles"]