Initial implementation of FTUE user lists design

This covers the "recents" section and rough design exclusively. It is known that the Field does nothing and that there's a bunch of missing functionality - this is to be iterated upon in future PRs. Labs flag is to aide development and should be removed in a very near future PR.

Also, this is focusing on DMs and not user lists in general because I misinterpreted the scope. I'll fix this in a future PR and instead make this the best DM invite dialog it can be.

Closes https://github.com/vector-im/riot-web/issues/11197
This commit is contained in:
Travis Ralston 2020-01-02 17:40:18 -07:00
parent 560cff0ae1
commit 4de0f7257a
11 changed files with 342 additions and 2 deletions

View file

@ -1,5 +1,6 @@
/*
Copyright 2016 OpenMarket Ltd
Copyright 2019, 2020 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -16,6 +17,7 @@ limitations under the License.
import MatrixClientPeg from '../MatrixClientPeg';
import _uniq from 'lodash/uniq';
import {Room} from "matrix-js-sdk/lib/matrix";
/**
* Class that takes a Matrix Client and flips the m.direct map
@ -144,6 +146,13 @@ export default class DMRoomMap {
return this.roomToUser[roomId];
}
getUniqueRoomsWithIndividuals(): {[userId: string]: Room} {
return Object.keys(this.roomToUser)
.map(r => ({userId: this.getUserIdForRoomId(r), room: this.matrixClient.getRoom(r)}))
.filter(r => r.userId && r.room && r.room.getInvitedAndJoinedMemberCount() === 2)
.reduce((obj, r) => (obj[r.userId] = r.room) && obj, {});
}
_getUserToRooms() {
if (!this.userToRooms) {
const userToRooms = this.mDirectEvent;