Merge pull request #246 from ouchadam/bug/edit-own-message

Fix edits changing message order
This commit is contained in:
Adam Brown 2022-11-03 17:57:35 +00:00 committed by GitHub
commit 1993ac12ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View File

@ -152,7 +152,6 @@ internal class TimelineEventMapper(
private fun RoomEvent.Message.edited(edit: ApiTimelineEvent.TimelineMessage) = this.copy( private fun RoomEvent.Message.edited(edit: ApiTimelineEvent.TimelineMessage) = this.copy(
content = richMessageParser.parse(edit.asTextContent().let { it.formattedBody ?: it.body }?.removePrefix(" * ") ?: "redacted"), content = richMessageParser.parse(edit.asTextContent().let { it.formattedBody ?: it.body }?.removePrefix(" * ") ?: "redacted"),
utcTimestamp = edit.utcTimestamp,
edited = true, edited = true,
) )

View File

@ -146,7 +146,7 @@ internal class RoomEventCreatorTest {
result shouldBeEqualTo aMatrixRoomMessageEvent( result shouldBeEqualTo aMatrixRoomMessageEvent(
eventId = originalMessage.eventId, eventId = originalMessage.eventId,
utcTimestamp = editedMessage.utcTimestamp, utcTimestamp = originalMessage.utcTimestamp,
content = A_TEXT_EVENT_MESSAGE, content = A_TEXT_EVENT_MESSAGE,
author = A_SENDER, author = A_SENDER,
edited = true edited = true
@ -166,7 +166,7 @@ internal class RoomEventCreatorTest {
replyingTo = originalMessage.replyingTo, replyingTo = originalMessage.replyingTo,
message = aMatrixRoomMessageEvent( message = aMatrixRoomMessageEvent(
eventId = originalMessage.eventId, eventId = originalMessage.eventId,
utcTimestamp = editedMessage.utcTimestamp, utcTimestamp = originalMessage.utcTimestamp,
content = A_TEXT_EVENT_MESSAGE, content = A_TEXT_EVENT_MESSAGE,
author = A_SENDER, author = A_SENDER,
edited = true edited = true