forked from mystiq/hydrogen-web
Merge branch 'master' of github.com:vector-im/hydrogen-web
This commit is contained in:
commit
59a74dbd9f
3 changed files with 4 additions and 17 deletions
|
@ -25,9 +25,6 @@ export class BaseTileViewModel extends ViewModel {
|
|||
super(options);
|
||||
this._isOpen = false;
|
||||
this._hidden = false;
|
||||
if (options.isOpen) {
|
||||
this.open();
|
||||
}
|
||||
}
|
||||
|
||||
get hidden() {
|
||||
|
|
|
@ -37,14 +37,15 @@ export class LeftPanelViewModel extends ViewModel {
|
|||
_mapTileViewModels(rooms, invites) {
|
||||
// join is not commutative, invites will take precedence over rooms
|
||||
return invites.join(rooms).mapValues((roomOrInvite, emitChange) => {
|
||||
const isOpen = this.navigation.path.get("room")?.value === roomOrInvite.id;
|
||||
let vm;
|
||||
if (roomOrInvite.isInvite) {
|
||||
vm = new InviteTileViewModel(this.childOptions({isOpen, invite: roomOrInvite, emitChange}));
|
||||
vm = new InviteTileViewModel(this.childOptions({invite: roomOrInvite, emitChange}));
|
||||
} else {
|
||||
vm = new RoomTileViewModel(this.childOptions({isOpen, room: roomOrInvite, emitChange}));
|
||||
vm = new RoomTileViewModel(this.childOptions({room: roomOrInvite, emitChange}));
|
||||
}
|
||||
const isOpen = this.navigation.path.get("room")?.value === roomOrInvite.id;
|
||||
if (isOpen) {
|
||||
vm.open();
|
||||
this._updateCurrentVM(vm);
|
||||
}
|
||||
return vm;
|
||||
|
|
|
@ -17,16 +17,11 @@ limitations under the License.
|
|||
|
||||
import {BaseTileViewModel} from "./BaseTileViewModel.js";
|
||||
|
||||
function isSortedAsUnread(vm) {
|
||||
return vm.isUnread || (vm.isOpen && vm._wasUnreadWhenOpening);
|
||||
}
|
||||
|
||||
export class RoomTileViewModel extends BaseTileViewModel {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
const {room} = options;
|
||||
this._room = room;
|
||||
this._wasUnreadWhenOpening = false;
|
||||
this._url = this.urlCreator.openRoomActionUrl(this._room.id);
|
||||
}
|
||||
|
||||
|
@ -57,12 +52,6 @@ export class RoomTileViewModel extends BaseTileViewModel {
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
if (isSortedAsUnread(this) !== isSortedAsUnread(other)) {
|
||||
if (isSortedAsUnread(this)) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
const myTimestamp = myRoom.lastMessageTimestamp;
|
||||
const theirTimestamp = theirRoom.lastMessageTimestamp;
|
||||
const myTimestampValid = Number.isSafeInteger(myTimestamp);
|
||||
|
|
Loading…
Reference in a new issue