Examine all m.direct rooms to find a DM as fallback (#10127)
This commit is contained in:
parent
1c6b06bb58
commit
a6eee32c66
7 changed files with 147 additions and 32 deletions
|
@ -192,6 +192,16 @@ export default class DMRoomMap {
|
|||
.reduce((obj, r) => (obj[r.userId] = r.room) && obj, {});
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns all room Ids from m.direct
|
||||
*/
|
||||
public getRoomIds(): Set<string> {
|
||||
return Object.values(this.mDirectEvent).reduce((prevRoomIds: Set<string>, roomIds: string[]): Set<string> => {
|
||||
roomIds.forEach((roomId) => prevRoomIds.add(roomId));
|
||||
return prevRoomIds;
|
||||
}, new Set<string>());
|
||||
}
|
||||
|
||||
private getUserToRooms(): { [key: string]: string[] } {
|
||||
if (!this.userToRooms) {
|
||||
const userToRooms = this.mDirectEvent;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue