Move reply previews to one line, fix android small text

This commit is contained in:
Cadence Ember 2024-08-16 01:08:01 +12:00
parent 5e4d539807
commit 283cf66906
2 changed files with 40 additions and 40 deletions

View file

@ -541,7 +541,7 @@ async function eventToMessage(event, guild, di) {
.replace(/<span [^>]*data-mx-spoiler\b[^>]*>.*?<\/span>/g, "[spoiler]") // Good enough method of removing spoiler content. (I don't want to break out the HTML parser unless I have to.)
.replace(/<[^>]+>/g, "") // Completely strip all HTML tags and formatting.
), 50)
replyLine = "> -# " + contentPreviewChunks[0]
replyLine = "-# > " + contentPreviewChunks[0]
if (contentPreviewChunks.length > 1) replyLine = replyLine.replace(/[,.']$/, "") + "..."
replyLine += "\n"
return
@ -565,7 +565,7 @@ async function eventToMessage(event, guild, di) {
assert(match)
senderName = match[1]
}
replyLine += `Ⓜ️**${senderName}**`
replyLine += `**${senderName}**`
}
// If the event has been edited, the homeserver will include the relation in `unsigned`.
if (repliedToEvent.unsigned?.["m.relations"]?.["m.replace"]?.content?.["m.new_content"]) {
@ -595,14 +595,14 @@ async function eventToMessage(event, guild, di) {
repliedToContent = entities.decodeHTML5Strict(repliedToContent) // Remove entities like &amp; &quot;
const contentPreviewChunks = chunk(repliedToContent, 50)
if (contentPreviewChunks.length) {
contentPreview = ":\n> -# " + contentPreviewChunks[0]
contentPreview = ": " + contentPreviewChunks[0]
if (contentPreviewChunks.length > 1) contentPreview = contentPreview.replace(/[,.']$/, "") + "..."
} else {
console.log("Unable to generate reply preview for this replied-to event because we stripped all of it:", repliedToEvent)
contentPreview = ""
}
}
replyLine = `> -# ${replyLine}${contentPreview}\n`
replyLine = `-# > ${replyLine}${contentPreview}\n`
})()
if (event.content.format === "org.matrix.custom.html" && event.content.formatted_body) {