mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Fix issue when quoting event in e2e rooms (Fixes #295)
This commit is contained in:
parent
a79a6443e7
commit
9d0c50907c
@ -42,7 +42,7 @@ interface SendService {
|
||||
* @param formattedText The formatted body using MessageType#FORMAT_MATRIX_HTML
|
||||
* @return a [Cancelable]
|
||||
*/
|
||||
fun sendFormattedTextMessage(text: String,formattedText: String): Cancelable
|
||||
fun sendFormattedTextMessage(text: String, formattedText: String): Cancelable
|
||||
|
||||
/**
|
||||
* Method to send a media asynchronously.
|
||||
|
@ -54,6 +54,19 @@ internal class DefaultSendService @Inject constructor(private val context: Conte
|
||||
val event = localEchoEventFactory.createTextEvent(roomId, msgType, text, autoMarkdown).also {
|
||||
saveLocalEcho(it)
|
||||
}
|
||||
|
||||
return sendEvent(event)
|
||||
}
|
||||
|
||||
override fun sendFormattedTextMessage(text: String, formattedText: String): Cancelable {
|
||||
val event = localEchoEventFactory.createFormattedTextEvent(roomId, text, formattedText).also {
|
||||
saveLocalEcho(it)
|
||||
}
|
||||
|
||||
return sendEvent(event)
|
||||
}
|
||||
|
||||
private fun sendEvent(event: Event): Cancelable {
|
||||
// Encrypted room handling
|
||||
return if (cryptoService.isRoomEncrypted(roomId)) {
|
||||
Timber.v("Send event in encrypted room")
|
||||
@ -62,25 +75,12 @@ internal class DefaultSendService @Inject constructor(private val context: Conte
|
||||
TimelineSendEventWorkCommon.postSequentialWorks(context, roomId, encryptWork, sendWork)
|
||||
CancelableWork(context, encryptWork.id)
|
||||
} else {
|
||||
sendEvent(event)
|
||||
val sendWork = createSendEventWork(event)
|
||||
TimelineSendEventWorkCommon.postWork(context, roomId, sendWork)
|
||||
CancelableWork(context, sendWork.id)
|
||||
}
|
||||
}
|
||||
|
||||
private fun sendEvent(event: Event): Cancelable {
|
||||
val sendWork = createSendEventWork(event)
|
||||
TimelineSendEventWorkCommon.postWork(context, roomId, sendWork)
|
||||
return CancelableWork(context, sendWork.id)
|
||||
}
|
||||
|
||||
override fun sendFormattedTextMessage(text: String, formattedText: String): Cancelable {
|
||||
val event = localEchoEventFactory.createFormattedTextEvent(roomId, text, formattedText).also {
|
||||
saveLocalEcho(it)
|
||||
}
|
||||
val sendWork = createSendEventWork(event)
|
||||
TimelineSendEventWorkCommon.postWork(context, roomId, sendWork)
|
||||
return CancelableWork(context, sendWork.id)
|
||||
}
|
||||
|
||||
override fun sendMedias(attachments: List<ContentAttachmentData>): Cancelable {
|
||||
val cancelableBag = CancelableBag()
|
||||
attachments.forEach {
|
||||
|
@ -233,7 +233,7 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro
|
||||
SendMode.QUOTE -> {
|
||||
val messageContent: MessageContent? =
|
||||
state.selectedEvent?.annotations?.editSummary?.aggregatedContent?.toModel()
|
||||
?: state.selectedEvent?.root?.content.toModel()
|
||||
?: state.selectedEvent?.root?.getClearContent().toModel()
|
||||
val textMsg = messageContent?.body
|
||||
|
||||
val finalText = legacyRiotQuoteText(textMsg, action.text)
|
||||
|
Loading…
Reference in New Issue
Block a user