Merge pull request #2116 from matrix-org/bwindels/ll_cleanup

Lazy loading: cleanup
This commit is contained in:
David Baker 2018-08-14 14:02:15 +01:00 committed by GitHub
commit b71e5590f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 8 deletions

View File

@ -45,7 +45,7 @@ export function getOnlyOtherMember(room, myUserId) {
function _isConfCallRoom(room, myUserId, conferenceHandler) {
if (!conferenceHandler) return false;
const myMembership = room.getMyMembership(myUserId);
const myMembership = room.getMyMembership();
if (myMembership != "join") {
return false;
}
@ -81,7 +81,7 @@ export function isConfCallRoom(room, myUserId, conferenceHandler) {
}
export function looksLikeDirectMessageRoom(room, myUserId) {
const myMembership = room.getMyMembership(myUserId);
const myMembership = room.getMyMembership();
const me = room.getMember(myUserId);
if (myMembership == "join" || myMembership === "ban" || (me && me.isKicked())) {
@ -90,8 +90,9 @@ export function looksLikeDirectMessageRoom(room, myUserId) {
// Used for 1:1 direct chats
// Show 1:1 chats in seperate "Direct Messages" section as long as they haven't
// been moved to a different tag section
// TODO: Use SUMMARYAPI to take invited users into account
if (room.currentState.getJoinedMemberCount() === 2 && !tagNames.length) {
const totalMemberCount = room.currentState.getJoinedMemberCount() +
room.currentState.getInvitedMemberCount();
if (totalMemberCount === 2 && !tagNames.length) {
return true;
}
}

View File

@ -174,7 +174,7 @@ class RoomListStore extends Store {
this._matrixClient.getRooms().forEach((room, index) => {
const myUserId = this._matrixClient.getUserId();
const membership = room.getMyMembership(myUserId);
const membership = room.getMyMembership();
const me = room.getMember(myUserId);
if (membership == "invite") {

View File

@ -96,10 +96,8 @@ export default class DMRoomMap {
if (this.roomToUser[roomId] === undefined) {
// no entry? if the room is an invite, look for the is_direct hint.
const room = this.matrixClient.getRoom(roomId);
// TODO Use SUMMARYAPI to fix DM detection?
if (room) {
const me = room.getMember(this.matrixClient.getUserId());
return me && me.getDMInviter();
return room.getDMInviter();
}
}
return this.roomToUser[roomId];