Send correct receipt when marking a room as read (#10730)
This commit is contained in:
parent
326e217d3f
commit
d084c34ea2
2 changed files with 28 additions and 15 deletions
|
@ -66,14 +66,7 @@ export function localNotificationsAreSilenced(cli: MatrixClient): boolean {
|
|||
* @returns a promise that resolves when the room has been marked as read
|
||||
*/
|
||||
export async function clearRoomNotification(room: Room, client: MatrixClient): Promise<{} | undefined> {
|
||||
const roomEvents = room.getLiveTimeline().getEvents();
|
||||
const lastThreadEvents = room.lastThread?.events;
|
||||
|
||||
const lastRoomEvent = roomEvents?.[roomEvents?.length - 1];
|
||||
const lastThreadLastEvent = lastThreadEvents?.[lastThreadEvents?.length - 1];
|
||||
|
||||
const lastEvent =
|
||||
(lastRoomEvent?.getTs() ?? 0) > (lastThreadLastEvent?.getTs() ?? 0) ? lastRoomEvent : lastThreadLastEvent;
|
||||
const lastEvent = room.getLastLiveEvent();
|
||||
|
||||
try {
|
||||
if (lastEvent) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue