From fa985f8f16d932a7c20a0acefcdf1356efee6483 Mon Sep 17 00:00:00 2001 From: Danila Fedorin <danila.fedorin@gmail.com> Date: Wed, 4 Aug 2021 09:30:02 -0700 Subject: [PATCH] Blurb isn't really the right word. --- src/matrix/room/timeline/entries/reply.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/matrix/room/timeline/entries/reply.js b/src/matrix/room/timeline/entries/reply.js index 7afae036..0120f332 100644 --- a/src/matrix/room/timeline/entries/reply.js +++ b/src/matrix/room/timeline/entries/reply.js @@ -18,7 +18,7 @@ function htmlEscape(string) { return string.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); } -function fallbackBlurb(msgtype) { +function fallbackForNonTextualMessage(msgtype) { switch (msgtype) { case "m.file": return "sent a file."; @@ -52,18 +52,18 @@ function createReply(targetId, msgtype, body, formattedBody) { export function reply(entry, msgtype, body) { // TODO check for absense of sender / body / msgtype / etc? - let blurb = fallbackBlurb(entry.content.msgtype); + const nonTextual = fallbackForNonTextualMessage(entry.content.msgtype); const prefix = fallbackPrefix(entry.content.msgtype); const sender = entry.sender; const name = entry.displayName || sender; - const formattedBody = blurb || entry.content.formatted_body || + const formattedBody = nonTextual || entry.content.formatted_body || (entry.content.body && htmlEscape(entry.content.body)) || ""; const formattedFallback = `<mx-reply><blockquote>In reply to ${prefix}` + `<a href="https://matrix.to/#/${sender}">${name}</a><br />` + `${formattedBody}</blockquote></mx-reply>`; - const plainBody = blurb || entry.content.body || ""; + const plainBody = nonTextual || entry.content.body || ""; const bodyLines = plainBody.split("\n"); bodyLines[0] = `> ${prefix}<${sender}> ${bodyLines[0]}` const plainFallback = bodyLines.join("\n> ");