mirror of
https://github.com/element-hq/element-web
synced 2024-11-26 19:26:04 +03:00
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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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") {
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue