pass room to _loadMembersIfJoined, it's called when newState not applied

_loadMembersIfJoined is called from
_onRoomLoaded < _onRoomViewStoreUpdate, before incoming state
from the store is applied to this.state, so looking up the room
with this.state.roomId doesn't always work, which would cause
the members not to be loaded. Pass in the room instead.
pull/21833/head
Bruno Windels 2018-09-17 19:24:34 +02:00
parent e0a789f77e
commit 473f2dd72b
1 changed files with 2 additions and 3 deletions

View File

@ -582,14 +582,13 @@ module.exports = React.createClass({
this._warnAboutEncryption(room);
this._calculatePeekRules(room);
this._updatePreviewUrlVisibility(room);
this._loadMembersIfJoined();
this._loadMembersIfJoined(room);
},
_loadMembersIfJoined: async function() {
_loadMembersIfJoined: async function(room) {
// lazy load members if enabled
if (SettingsStore.isFeatureEnabled('feature_lazyloading')) {
const cli = MatrixClientPeg.get();
const room = cli.getRoom(this.state.roomId);
if (room && room.getMyMembership() === 'join') {
try {
await room.loadMembersIfNeeded();