Fix selecting dm always open dm tab

This commit is contained in:
Ajay Bura 2022-08-20 16:21:22 +05:30
parent 1ec7322830
commit 7c3a32641c

View file

@ -91,13 +91,14 @@ class Navigation extends EventEmitter {
_selectTabWithRoom(roomId) {
const { roomList, accountData } = this.initMatrix;
const { categorizedSpaces } = accountData;
if (roomList.directs.has(roomId)) {
this._selectSpace(null, true, false);
this._selectTab(cons.tabs.DIRECTS, false);
return;
}
if (roomList.isOrphan(roomId)) {
if (roomList.directs.has(roomId)) {
this._selectSpace(null, true, false);
this._selectTab(cons.tabs.DIRECTS, false);
return;
}
this._selectSpace(null, true, false);
this._selectTab(cons.tabs.HOME, false);
return;
@ -109,7 +110,6 @@ class Navigation extends EventEmitter {
return;
}
const { categorizedSpaces } = accountData;
if (categorizedSpaces.has(this.selectedSpaceId)) {
const categories = roomList.getCategorizedSpaces([this.selectedSpaceId]);
if ([...parents].find((pId) => categories.has(pId))) {
@ -125,6 +125,12 @@ class Navigation extends EventEmitter {
return;
}
if (roomList.directs.has(roomId)) {
this._selectSpace(null, true, false);
this._selectTab(cons.tabs.DIRECTS, false);
return;
}
if (parents.size > 0) {
const sortedParents = [...parents].sort((p1, p2) => {
const t1 = this.spaceToRoom.get(p1)?.timestamp ?? 0;