Skip to content

Commit 6571e80

Browse files
fix: TextEdited not updating when sent
* Add additional parameter for replacingMessageId
1 parent 3d665a1 commit 6571e80

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

lib/src/main/kotlin/com/wire/integrations/jvm/model/WireMessage.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ sealed interface WireMessage {
499499
override val id: UUID,
500500
override val conversationId: QualifiedId,
501501
override val sender: QualifiedId,
502+
val replacingMessageId: UUID,
502503
val newContent: String,
503504
val newLinkPreviews: List<LinkPreview> = emptyList(),
504505
val newMentions: List<Mention> = emptyList()
@@ -507,21 +508,22 @@ sealed interface WireMessage {
507508
/**
508509
* Creates a TextEdited message with minimal required parameters.
509510
*
510-
* @param originalMessageId The UUID of the original message to be edited.
511+
* @param replacingMessageId The UUID of the original message to be edited.
511512
* @param conversationId The qualified ID of the conversation
512513
* @param text The text content of the message
513514
* @param mentions List of [Mention] included in the text
514515
* @return A new TextEdited message with the original received ID.
515516
*/
516517
@JvmStatic
517518
fun create(
518-
originalMessageId: UUID,
519+
replacingMessageId: UUID,
519520
conversationId: QualifiedId,
520521
text: String,
521522
mentions: List<Mention> = emptyList()
522523
): TextEdited {
523524
return TextEdited(
524-
id = originalMessageId,
525+
id = UUID.randomUUID(),
526+
replacingMessageId = replacingMessageId,
525527
conversationId = conversationId,
526528
sender = QualifiedId(
527529
id = UUID.randomUUID(),

lib/src/main/kotlin/com/wire/integrations/jvm/model/protobuf/ProtobufDeserializer.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,8 @@ object ProtobufDeserializer {
383383
MessageMentionMapper.fromProtobuf(it)
384384
}
385385
WireMessage.TextEdited(
386-
id = UUID.fromString(replacingMessageId),
386+
id = UUID.fromString(genericMessage.messageId),
387+
replacingMessageId = UUID.fromString(replacingMessageId),
387388
conversationId = conversationId,
388389
sender = sender,
389390
newContent = genericMessage.text.content,

lib/src/main/kotlin/com/wire/integrations/jvm/model/protobuf/ProtobufSerializer.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ object ProtobufSerializer {
346346
.setEdited(
347347
MessageEdit
348348
.newBuilder()
349-
.setReplacingMessageId(wireMessage.id.toString())
349+
.setReplacingMessageId(wireMessage.replacingMessageId.toString())
350350
.setText(
351351
packText(
352352
wireMessage = WireMessage.Text.create(
@@ -356,6 +356,7 @@ object ProtobufSerializer {
356356
)
357357
)
358358
)
359+
.build()
359360
)
360361

361362
private fun packReaction(

0 commit comments

Comments
 (0)