From e1b9aa9626c26a157d26bb19315788ab8e2da4c0 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 17 Sep 2018 19:20:26 +0200 Subject: [PATCH] better naming and document method --- src/components/views/rooms/MemberList.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/views/rooms/MemberList.js b/src/components/views/rooms/MemberList.js index 2d3bc69ced..b7a64e0ec4 100644 --- a/src/components/views/rooms/MemberList.js +++ b/src/components/views/rooms/MemberList.js @@ -47,7 +47,7 @@ module.exports = React.createClass({ if (cli.hasLazyLoadMembersEnabled()) { // true means will not show a spinner but the // known members so far if not joined - this._loadMembersIfNeeded(true); + this._waitForMembersIfJoinedAndLL(true); cli.on("Room.myMembership", this.onMyMembership); } else { this._listenForMembersChanges(); @@ -93,7 +93,12 @@ module.exports = React.createClass({ this._updateList.cancelPendingCall(); }, - _loadMembersIfNeeded: async function(initial) { + /** + * If lazy loading is enabled, either: + * show a spinner and load the members if the user is joined, + * or show the members available so far if initial=true + */ + _waitForMembersIfJoinedAndLL: async function(initial) { const cli = MatrixClientPeg.get(); if (cli.hasLazyLoadMembersEnabled()) { const cli = MatrixClientPeg.get(); @@ -153,12 +158,12 @@ module.exports = React.createClass({ // also when peeking, we need to await the members being loaded // before showing them. - this._loadMembersIfNeeded(); + this._waitForMembersIfJoinedAndLL(); }, onMyMembership: function(room, membership, oldMembership) { if (room.roomId === this.props.roomId && membership === "join") { - this._loadMembersIfNeeded(); + this._waitForMembersIfJoinedAndLL(); } },