Fix reply fallback format

Signed-off-by: Tulir Asokan <tulir@maunium.net>
This commit is contained in:
Tulir Asokan 2020-07-03 23:10:44 +03:00
parent 586b0fe6e2
commit e9ba7342d5
2 changed files with 6 additions and 7 deletions

View File

@ -10,6 +10,7 @@ Improvements 🙌:
Bugfix 🐛: Bugfix 🐛:
- Fix crash when coming from a notification (#1601) - Fix crash when coming from a notification (#1601)
- Fix Exception when importing keys (#1576) - Fix Exception when importing keys (#1576)
- Fix reply fallback leaking sender locale (#429)
Translations 🗣: Translations 🗣:
- -

View File

@ -177,7 +177,6 @@ internal class LocalEchoEventFactory @Inject constructor(
val body = bodyForReply(originalEvent.getLastMessageContent(), originalEvent.root.getClearContent().toModel()) val body = bodyForReply(originalEvent.getLastMessageContent(), originalEvent.root.getClearContent().toModel())
val replyFormatted = REPLY_PATTERN.format( val replyFormatted = REPLY_PATTERN.format(
permalink, permalink,
stringProvider.getString(R.string.message_reply_to_prefix),
userLink, userLink,
originalEvent.senderInfo.disambiguatedDisplayName, originalEvent.senderInfo.disambiguatedDisplayName,
body.takeFormatted(), body.takeFormatted(),
@ -372,7 +371,6 @@ internal class LocalEchoEventFactory @Inject constructor(
val body = bodyForReply(eventReplied.getLastMessageContent(), eventReplied.root.getClearContent().toModel()) val body = bodyForReply(eventReplied.getLastMessageContent(), eventReplied.root.getClearContent().toModel())
val replyFormatted = REPLY_PATTERN.format( val replyFormatted = REPLY_PATTERN.format(
permalink, permalink,
stringProvider.getString(R.string.message_reply_to_prefix),
userLink, userLink,
userId, userId,
body.takeFormatted(), body.takeFormatted(),
@ -434,10 +432,10 @@ internal class LocalEchoEventFactory @Inject constructor(
TextContent(content.body, formattedText) TextContent(content.body, formattedText)
} }
} }
MessageType.MSGTYPE_FILE -> return TextContent(stringProvider.getString(R.string.reply_to_a_file)) MessageType.MSGTYPE_FILE -> return TextContent("sent a file.")
MessageType.MSGTYPE_AUDIO -> return TextContent(stringProvider.getString(R.string.reply_to_an_audio_file)) MessageType.MSGTYPE_AUDIO -> return TextContent("sent an audio file.")
MessageType.MSGTYPE_IMAGE -> return TextContent(stringProvider.getString(R.string.reply_to_an_image)) MessageType.MSGTYPE_IMAGE -> return TextContent("sent an image.")
MessageType.MSGTYPE_VIDEO -> return TextContent(stringProvider.getString(R.string.reply_to_a_video)) MessageType.MSGTYPE_VIDEO -> return TextContent("sent a video.")
else -> return TextContent(content?.body ?: "") else -> return TextContent(content?.body ?: "")
} }
} }
@ -489,6 +487,6 @@ internal class LocalEchoEventFactory @Inject constructor(
// </blockquote> // </blockquote>
// </mx-reply> // </mx-reply>
// No whitespace because currently breaks temporary formatted text to Span // No whitespace because currently breaks temporary formatted text to Span
const val REPLY_PATTERN = """<mx-reply><blockquote><a href="%s">%s</a><a href="%s">%s</a><br />%s</blockquote></mx-reply>%s""" const val REPLY_PATTERN = """<mx-reply><blockquote><a href="%s">In reply to</a> <a href="%s">%s</a><br />%s</blockquote></mx-reply>%s"""
} }
} }