From 74f7879cb6f19f4945508a1021643d5499d481d6 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 10 Feb 2022 09:39:27 +0100 Subject: [PATCH] fix unrelated bug: invite sorting order wasn't stable in left panel as the timestamp is the same when you receive the invite during your first sync --- src/domain/session/leftpanel/InviteTileViewModel.js | 6 +++++- src/matrix/room/create.ts | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/domain/session/leftpanel/InviteTileViewModel.js b/src/domain/session/leftpanel/InviteTileViewModel.js index 09c11fb8..bdc0e193 100644 --- a/src/domain/session/leftpanel/InviteTileViewModel.js +++ b/src/domain/session/leftpanel/InviteTileViewModel.js @@ -39,6 +39,10 @@ export class InviteTileViewModel extends BaseTileViewModel { if (parentComparison !== 0) { return parentComparison; } - return other._invite.timestamp - this._invite.timestamp; + const timeDiff = other._invite.timestamp - this._invite.timestamp; + if (timeDiff !== 0) { + return timeDiff; + } + return this._invite.id < other._invite.id ? -1 : 1; } } diff --git a/src/matrix/room/create.ts b/src/matrix/room/create.ts index e3a1ed4d..6dd9340a 100644 --- a/src/matrix/room/create.ts +++ b/src/matrix/room/create.ts @@ -194,7 +194,8 @@ export class RoomBeingCreated extends EventEmitter<{change: never}> { get name() { return this._calculatedName; } get isBeingCreated(): boolean { return true; } get error(): Error | undefined { return this._error; } - + get id() { return this.localId; } + cancel() { // TODO: remove from collection somehow }