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; 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.