Remove extra space in <mx-reply>
This commit is contained in:
parent
e6c74dc1fe
commit
228ee52563
|
@ -260,21 +260,19 @@ internal class LocalEchoEventFactory @Inject constructor(private val credentials
|
||||||
// </mx-reply>
|
// </mx-reply>
|
||||||
// This is where the reply goes.
|
// This is where the reply goes.
|
||||||
val body = bodyForReply(eventReplied.getClearContent().toModel<MessageContent>())
|
val body = bodyForReply(eventReplied.getClearContent().toModel<MessageContent>())
|
||||||
val replyFallbackTemplateFormatted = """<mx-reply>
|
val replyFallbackTemplateFormatted = REPLY_PATTERN.format(
|
||||||
<blockquote>
|
permalink,
|
||||||
<a href="%s">${stringProvider.getString(R.string.message_reply_to_prefix)}</a>
|
stringProvider.getString(R.string.message_reply_to_prefix),
|
||||||
<a href="%s">%s</a>
|
userLink,
|
||||||
<br />
|
userId,
|
||||||
%s
|
body.second ?: body.first,
|
||||||
</blockquote>
|
replyText
|
||||||
</mx-reply>
|
)
|
||||||
%s""".trimIndent().format(permalink, userLink, userId, body.second ?: body.first, replyText)
|
|
||||||
//
|
//
|
||||||
// > <@alice:example.org> This is the original body
|
// > <@alice:example.org> This is the original body
|
||||||
//
|
//
|
||||||
// This is where the reply goes
|
|
||||||
val lines = body.first.split("\n")
|
val lines = body.first.split("\n")
|
||||||
val plainTextBody = StringBuffer("><${userId}>")
|
val plainTextBody = StringBuffer("><$userId>")
|
||||||
lines.firstOrNull()?.also { plainTextBody.append(" $it") }
|
lines.firstOrNull()?.also { plainTextBody.append(" $it") }
|
||||||
lines.forEachIndexed { index, s ->
|
lines.forEachIndexed { index, s ->
|
||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
|
@ -365,6 +363,9 @@ internal class LocalEchoEventFactory @Inject constructor(private val credentials
|
||||||
companion object {
|
companion object {
|
||||||
const val LOCAL_ID_PREFIX = "local."
|
const val LOCAL_ID_PREFIX = "local."
|
||||||
|
|
||||||
|
// No whitespace
|
||||||
|
const val REPLY_PATTERN = """<mx-reply><blockquote><a href="%s">%s</a><a href="%s">%s</a><br />%s</blockquote></mx-reply>%s"""
|
||||||
|
|
||||||
fun isLocalEchoId(eventId: String): Boolean = eventId.startsWith(LOCAL_ID_PREFIX)
|
fun isLocalEchoId(eventId: String): Boolean = eventId.startsWith(LOCAL_ID_PREFIX)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue