From 49a135485c6e9b0e76029d113e2808bc8aa0c2b0 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Mon, 2 Oct 2023 22:26:00 +1300 Subject: [PATCH] Regression: Embeds belong in quotes --- .../message-to-event.embeds.test.js | 30 +++++++++---------- d2m/converters/message-to-event.js | 3 +- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/d2m/converters/message-to-event.embeds.test.js b/d2m/converters/message-to-event.embeds.test.js index 75a4ffb7..93d189c4 100644 --- a/d2m/converters/message-to-event.embeds.test.js +++ b/d2m/converters/message-to-event.embeds.test.js @@ -35,14 +35,14 @@ test("message2event embeds: nothing but a field", async t => { $type: "m.room.message", "m.mentions": {}, msgtype: "m.notice", - body: "**Amanda 🎵#2192 :online:" - + "\nwillow tree, branch 0**" - + "\n**❯ Uptime:**\n3m 55s\n**❯ Memory:**\n64.45MB", + body: "> **Amanda 🎵#2192 :online:" + + "\n> willow tree, branch 0**" + + "\n> **❯ Uptime:**\n> 3m 55s\n> **❯ Memory:**\n> 64.45MB", format: "org.matrix.custom.html", - formatted_body: 'Amanda 🎵#2192 \":online:\"' + formatted_body: '
Amanda 🎵#2192 \":online:\"' + '
willow tree, branch 0
' + '
❯ Uptime:
3m 55s' - + '
❯ Memory:
64.45MB' + + '
❯ Memory:
64.45MB
' }]) }) @@ -52,19 +52,19 @@ test("message2event embeds: reply with just an embed", async t => { $type: "m.room.message", msgtype: "m.notice", "m.mentions": {}, - body: "[**⏺️ dynastic (@dynastic)**](https://twitter.com/i/user/719631291747078145)" - + "\n\n**https://twitter.com/i/status/1707484191963648161**" - + "\n\ndoes anyone know where to find that one video of the really mysterious yam-like object being held up to a bunch of random objects, like clocks, and they have unexplained impossible reactions to it?" - + "\n\n**Retweets**" - + "\n119" - + "\n\n**Likes**" - + "\n5581" - + "\n\n— Twitter", + body: "> [**⏺️ dynastic (@dynastic)**](https://twitter.com/i/user/719631291747078145)" + + "\n> \n> **https://twitter.com/i/status/1707484191963648161**" + + "\n> \n> does anyone know where to find that one video of the really mysterious yam-like object being held up to a bunch of random objects, like clocks, and they have unexplained impossible reactions to it?" + + "\n> \n> **Retweets**" + + "\n> 119" + + "\n> \n> **Likes**" + + "\n> 5581" + + "\n> \n> — Twitter", format: "org.matrix.custom.html", - formatted_body: '⏺️ dynastic (@dynastic)' + formatted_body: '
⏺️ dynastic (@dynastic)' + '

https://twitter.com/i/status/1707484191963648161' + '

does anyone know where to find that one video of the really mysterious yam-like object being held up to a bunch of random objects, like clocks, and they have unexplained impossible reactions to it?' - + '

Retweets
119

Likes
5581

— Twitter' + + '

Retweets
119

Likes
5581

— Twitter
' }]) }) diff --git a/d2m/converters/message-to-event.js b/d2m/converters/message-to-event.js index 8850f45c..ce724b06 100644 --- a/d2m/converters/message-to-event.js +++ b/d2m/converters/message-to-event.js @@ -390,9 +390,10 @@ async function messageToEvent(message, guild, options = {}, di) { } if (embed.footer?.text) repParagraphs.push(`— ${embed.footer.text}`) const repContent = repParagraphs.join("\n\n") + const repContentQuoted = repContent.split("\n").map(l => "> " + l).join("\n") // Send as m.notice to apply the usual automated/subtle appearance, showing this wasn't actually typed by the person - await addTextEvent(repContent, "m.notice", {scanMentions: false}) + await addTextEvent(repContentQuoted, "m.notice", {scanMentions: false}) } // Then stickers