From db93d8049e8bff08bf5dcae7879988e20c99fab7 Mon Sep 17 00:00:00 2001 From: Shunmugaraj Date: Thu, 23 Jun 2022 11:25:15 +0300 Subject: [PATCH 1/2] Delete option for unsend messages not working fix --- .../MatrixKit/Models/Room/MXKRoomDataSource.m | 15 +++++++-------- Riot/Modules/Room/RoomViewController.m | 18 ++++++------------ 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/Riot/Modules/MatrixKit/Models/Room/MXKRoomDataSource.m b/Riot/Modules/MatrixKit/Models/Room/MXKRoomDataSource.m index 12e2deffa6..3ed3c1a184 100644 --- a/Riot/Modules/MatrixKit/Models/Room/MXKRoomDataSource.m +++ b/Riot/Modules/MatrixKit/Models/Room/MXKRoomDataSource.m @@ -2356,15 +2356,14 @@ - (void)removeEventWithEventId:(NSString *)eventId { [self removeCellData:bubbleData]; } - - // Remove the event from the outgoing messages storage - [_room removeOutgoingMessage:eventId]; + } + // Remove the event from the outgoing messages storage + [_room removeOutgoingMessage:eventId]; - // Update the delegate - if (self.delegate) - { - [self.delegate dataSource:self didCellChange:nil]; - } + // Update the delegate + if (self.delegate) + { + [self.delegate dataSource:self didCellChange:nil]; } } diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index 4a6caca8c8..8788a052aa 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -5912,18 +5912,12 @@ - (void)cancelAllUnsentMessages [cancelAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n delete] style:UIAlertActionStyleDestructive handler:^(UIAlertAction * action) { MXStrongifyAndReturnIfNil(self); // Remove unsent event ids - for (NSUInteger index = 0; index < self.roomDataSource.room.outgoingMessages.count;) - { - MXEvent *event = self.roomDataSource.room.outgoingMessages[index]; - if (event.sentState == MXEventSentStateFailed) - { - [self.roomDataSource removeEventWithEventId:event.eventId]; - } - else - { - index ++; - } - } + [self.roomDataSource.room.outgoingMessages enumerateObjectsUsingBlock:^(MXEvent *event, NSUInteger idx, BOOL *stop) { + if (event.sentState == MXEventSentStateFailed) + { + [self.roomDataSource removeEventWithEventId:event.eventId]; + } + }]; [self refreshActivitiesViewDisplay]; self->currentAlert = nil; From e340a57ee0a06128c9dd61ec57bcae05ceef5730 Mon Sep 17 00:00:00 2001 From: Shunmugaraj Date: Sun, 26 Jun 2022 11:41:26 +0300 Subject: [PATCH 2/2] Adding the changelog Signed-off-by: Shunmugaraj S toshanmugaraj@gmail.com --- changelog.d/6344.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/6344.bugfix diff --git a/changelog.d/6344.bugfix b/changelog.d/6344.bugfix new file mode 100644 index 0000000000..7ea1f3a971 --- /dev/null +++ b/changelog.d/6344.bugfix @@ -0,0 +1 @@ +Warning Alert: fix failed message delete / retry not getting cancelled for ever when there is no cell data, but has unsend message event.