m->d: Strip colons from user mentions

This commit is contained in:
Cadence Ember 2023-10-28 00:37:20 +13:00
parent afbbe0da3d
commit e73de60d77
2 changed files with 35 additions and 1 deletions

View file

@ -401,6 +401,10 @@ async function eventToMessage(event, guild, di) {
return `${attributeValue} data-channel-id="${channelID}">`
})
// Stripping colons after mentions
input = input.replace(/( data-user-id.*?<\/a>):?/g, "$1")
input = input.replace(/("https:\/\/matrix.to.*?<\/a>):?/g, "$1")
// Element adds a bunch of <br> before </blockquote> but doesn't render them. I can't figure out how this even works in the browser, so let's just delete those.
input = input.replace(/(?:\n|<br ?\/?>\s*)*<\/blockquote>/g, "</blockquote>")