From 7ea913ccecbae5ccf887e16358bb3faa93bd7f57 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 25 Jul 2018 14:14:36 +0200 Subject: [PATCH] fall back to synced membership when own membership is not yet available (due to lazy loading) --- src/stores/RoomListStore.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/stores/RoomListStore.js b/src/stores/RoomListStore.js index 8dbfca8875..b95eafa2ab 100644 --- a/src/stores/RoomListStore.js +++ b/src/stores/RoomListStore.js @@ -174,11 +174,11 @@ class RoomListStore extends Store { this._matrixClient.getRooms().forEach((room, index) => { const me = room.getMember(this._matrixClient.credentials.userId); - if (!me) return; + const membership = me ? me.membership : room.getSyncedMembership(); - if (me.membership == "invite") { + if (membership == "invite") { lists["im.vector.fake.invite"].push(room); - } else if (me.membership == "join" || me.membership === "ban" || me.isKicked()) { + } else if (membership == "join" || membership === "ban" || me.isKicked()) { // Used to split rooms via tags let tagNames = Object.keys(room.tags); @@ -205,10 +205,10 @@ class RoomListStore extends Store { } else { lists["im.vector.fake.recent"].push(room); } - } else if (me.membership === "leave") { + } else if (membership === "leave") { lists["im.vector.fake.archived"].push(room); } else { - console.error("unrecognised membership: " + me.membership + " - this should never happen"); + console.error("unrecognised membership: " + membership + " - this should never happen"); } });