Skip to content

Commit

Permalink
Bug Fix - Mark all messages as read does not work well
Browse files Browse the repository at this point in the history
  • Loading branch information
giomfo committed Oct 19, 2017
1 parent 124639d commit c2b0170
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion MatrixSDK/Data/MXRoom.m
Original file line number Diff line number Diff line change
Expand Up @@ -2001,7 +2001,9 @@ - (void)markAllAsRead
NSString *readMarkerEventId = nil;
MXReceiptData *updatedReceiptData = nil;

NSString *lastMessageEventId = self.summary.lastMessageEvent.eventId;
// Retrieve the most recent event of the room.
MXEvent *lastEvent = [mxSession.store messagesEnumeratorForRoom:self.roomId].nextEvent;
NSString *lastMessageEventId = lastEvent.eventId;

// Sanity check: Do not send read marker on event without id.
if (!lastMessageEventId || [lastMessageEventId hasPrefix:kMXRoomInviteStateEventIdPrefix])
Expand Down Expand Up @@ -2048,6 +2050,9 @@ - (void)markAllAsRead
}
}
}

// Break the loop
break;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion MatrixSDK/Data/MXRoomSummary.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ FOUNDATION_EXPORT NSString *const kMXRoomSummaryDidChangeNotification;
#pragma mark - Data related to room state

/**
The avatar url of the room.
The Matrix content URI of the room avatar.
*/
@property (nonatomic) NSString *avatar;

Expand Down

0 comments on commit c2b0170

Please sign in to comment.