Merge pull request #1425 from matrix-org/rav/memberlist_fixes
Fix NPE in MemberList
This commit is contained in:
commit
175fed490f
1 changed files with 8 additions and 18 deletions
|
@ -18,12 +18,7 @@ limitations under the License.
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import classNames from 'classnames';
|
|
||||||
import Matrix from 'matrix-js-sdk';
|
|
||||||
import Promise from 'bluebird';
|
|
||||||
var MatrixClientPeg = require("../../../MatrixClientPeg");
|
var MatrixClientPeg = require("../../../MatrixClientPeg");
|
||||||
var Modal = require("../../../Modal");
|
|
||||||
var Entities = require("../../../Entities");
|
|
||||||
var sdk = require('../../../index');
|
var sdk = require('../../../index');
|
||||||
var GeminiScrollbar = require('react-gemini-scrollbar');
|
var GeminiScrollbar = require('react-gemini-scrollbar');
|
||||||
var rate_limited_func = require('../../../ratelimitedfunc');
|
var rate_limited_func = require('../../../ratelimitedfunc');
|
||||||
|
@ -36,25 +31,20 @@ module.exports = React.createClass({
|
||||||
displayName: 'MemberList',
|
displayName: 'MemberList',
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
const state = {
|
this.memberDict = this.getMemberDict();
|
||||||
members: [],
|
const members = this.roomMembers();
|
||||||
|
|
||||||
|
return {
|
||||||
|
members: members,
|
||||||
|
filteredJoinedMembers: this._filterMembers(members, 'join'),
|
||||||
|
filteredInvitedMembers: this._filterMembers(members, 'invite'),
|
||||||
|
|
||||||
// ideally we'd size this to the page height, but
|
// ideally we'd size this to the page height, but
|
||||||
// in practice I find that a little constraining
|
// in practice I find that a little constraining
|
||||||
truncateAtJoined: INITIAL_LOAD_NUM_MEMBERS,
|
truncateAtJoined: INITIAL_LOAD_NUM_MEMBERS,
|
||||||
truncateAtInvited: INITIAL_LOAD_NUM_INVITED,
|
truncateAtInvited: INITIAL_LOAD_NUM_INVITED,
|
||||||
searchQuery: "",
|
searchQuery: "",
|
||||||
};
|
};
|
||||||
if (!this.props.roomId) return state;
|
|
||||||
var cli = MatrixClientPeg.get();
|
|
||||||
var room = cli.getRoom(this.props.roomId);
|
|
||||||
if (!room) return state;
|
|
||||||
|
|
||||||
this.memberDict = this.getMemberDict();
|
|
||||||
|
|
||||||
state.members = this.roomMembers();
|
|
||||||
state.filteredJoinedMembers = this._filterMembers(state.members, 'join');
|
|
||||||
state.filteredInvitedMembers = this._filterMembers(state.members, 'invite');
|
|
||||||
return state;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillMount: function() {
|
componentWillMount: function() {
|
||||||
|
|
Loading…
Reference in a new issue