Merge pull request #2116 from matrix-org/bwindels/ll_cleanup
Lazy loading: cleanup
This commit is contained in:
commit
b71e5590f9
3 changed files with 7 additions and 8 deletions
|
@ -45,7 +45,7 @@ export function getOnlyOtherMember(room, myUserId) {
|
||||||
function _isConfCallRoom(room, myUserId, conferenceHandler) {
|
function _isConfCallRoom(room, myUserId, conferenceHandler) {
|
||||||
if (!conferenceHandler) return false;
|
if (!conferenceHandler) return false;
|
||||||
|
|
||||||
const myMembership = room.getMyMembership(myUserId);
|
const myMembership = room.getMyMembership();
|
||||||
if (myMembership != "join") {
|
if (myMembership != "join") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ export function isConfCallRoom(room, myUserId, conferenceHandler) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function looksLikeDirectMessageRoom(room, myUserId) {
|
export function looksLikeDirectMessageRoom(room, myUserId) {
|
||||||
const myMembership = room.getMyMembership(myUserId);
|
const myMembership = room.getMyMembership();
|
||||||
const me = room.getMember(myUserId);
|
const me = room.getMember(myUserId);
|
||||||
|
|
||||||
if (myMembership == "join" || myMembership === "ban" || (me && me.isKicked())) {
|
if (myMembership == "join" || myMembership === "ban" || (me && me.isKicked())) {
|
||||||
|
@ -90,8 +90,9 @@ export function looksLikeDirectMessageRoom(room, myUserId) {
|
||||||
// Used for 1:1 direct chats
|
// Used for 1:1 direct chats
|
||||||
// Show 1:1 chats in seperate "Direct Messages" section as long as they haven't
|
// Show 1:1 chats in seperate "Direct Messages" section as long as they haven't
|
||||||
// been moved to a different tag section
|
// been moved to a different tag section
|
||||||
// TODO: Use SUMMARYAPI to take invited users into account
|
const totalMemberCount = room.currentState.getJoinedMemberCount() +
|
||||||
if (room.currentState.getJoinedMemberCount() === 2 && !tagNames.length) {
|
room.currentState.getInvitedMemberCount();
|
||||||
|
if (totalMemberCount === 2 && !tagNames.length) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ class RoomListStore extends Store {
|
||||||
|
|
||||||
this._matrixClient.getRooms().forEach((room, index) => {
|
this._matrixClient.getRooms().forEach((room, index) => {
|
||||||
const myUserId = this._matrixClient.getUserId();
|
const myUserId = this._matrixClient.getUserId();
|
||||||
const membership = room.getMyMembership(myUserId);
|
const membership = room.getMyMembership();
|
||||||
const me = room.getMember(myUserId);
|
const me = room.getMember(myUserId);
|
||||||
|
|
||||||
if (membership == "invite") {
|
if (membership == "invite") {
|
||||||
|
|
|
@ -96,10 +96,8 @@ export default class DMRoomMap {
|
||||||
if (this.roomToUser[roomId] === undefined) {
|
if (this.roomToUser[roomId] === undefined) {
|
||||||
// no entry? if the room is an invite, look for the is_direct hint.
|
// no entry? if the room is an invite, look for the is_direct hint.
|
||||||
const room = this.matrixClient.getRoom(roomId);
|
const room = this.matrixClient.getRoom(roomId);
|
||||||
// TODO Use SUMMARYAPI to fix DM detection?
|
|
||||||
if (room) {
|
if (room) {
|
||||||
const me = room.getMember(this.matrixClient.getUserId());
|
return room.getDMInviter();
|
||||||
return me && me.getDMInviter();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.roomToUser[roomId];
|
return this.roomToUser[roomId];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue