mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-09 08:40:29 +03:00
Fix new message not appearing (#391)
* Fix new message no appearing Signed-off-by: Ajay Bura <ajbura@gmail.com> * Fix room not marking as read Signed-off-by: Ajay Bura <ajbura@gmail.com> * Fix room automatically gets mark as read Signed-off-by: Ajay Bura <ajbura@gmail.com> * Fix sending wrong read recipt Signed-off-by: Ajay Bura <ajbura@gmail.com> * Fix sending message not mark as read Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
parent
0d59a4de48
commit
f5720bde14
3 changed files with 73 additions and 61 deletions
|
|
@ -230,9 +230,18 @@ class RoomTimeline extends EventEmitter {
|
|||
|
||||
markAllAsRead() {
|
||||
const readEventId = this.getReadUpToEventId();
|
||||
const getLatestValidEvent = () => {
|
||||
for (let i = this.timeline.length - 1; i >= 0; i -= 1) {
|
||||
const latestEvent = this.timeline[i];
|
||||
if (latestEvent.getId() === readEventId) return null;
|
||||
if (!latestEvent.isSending()) return latestEvent;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
this.notifications.deleteNoti(this.roomId);
|
||||
if (this.timeline.length === 0) return;
|
||||
const latestEvent = this.timeline[this.timeline.length - 1];
|
||||
const latestEvent = getLatestValidEvent();
|
||||
if (latestEvent === null) return;
|
||||
if (readEventId === latestEvent.getId()) return;
|
||||
this.matrixClient.sendReadReceipt(latestEvent);
|
||||
this.emit(cons.events.roomTimeline.MARKED_AS_READ, latestEvent);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue