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, ">"); } -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 = `
In reply to ${prefix}` + `${name}
` + `${formattedBody}
`; - 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> ");