mirror of
https://gitdab.com/cadence/out-of-your-element.git
synced 2025-09-10 12:22:50 +02:00
Move reply previews to one line, fix android small text
This commit is contained in:
parent
5e4d539807
commit
283cf66906
2 changed files with 40 additions and 40 deletions
|
@ -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 & "
|
||||
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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue