remove initial parameter and show available members on invite instead
This commit is contained in:
parent
0727e0f8d3
commit
8c4f4765df
1 changed files with 9 additions and 10 deletions
|
@ -45,9 +45,7 @@ module.exports = React.createClass({
|
||||||
this._mounted = true;
|
this._mounted = true;
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
if (cli.hasLazyLoadMembersEnabled()) {
|
if (cli.hasLazyLoadMembersEnabled()) {
|
||||||
// true means will not show a spinner but the
|
this._showMembersAccordingToMembershipWithLL();
|
||||||
// known members so far if not joined
|
|
||||||
this._waitForMembersIfJoinedAndLL(true);
|
|
||||||
cli.on("Room.myMembership", this.onMyMembership);
|
cli.on("Room.myMembership", this.onMyMembership);
|
||||||
} else {
|
} else {
|
||||||
this._listenForMembersChanges();
|
this._listenForMembersChanges();
|
||||||
|
@ -92,14 +90,15 @@ module.exports = React.createClass({
|
||||||
/**
|
/**
|
||||||
* If lazy loading is enabled, either:
|
* If lazy loading is enabled, either:
|
||||||
* show a spinner and load the members if the user is joined,
|
* show a spinner and load the members if the user is joined,
|
||||||
* or show the members available so far if initial=true
|
* or show the members available so far if the user is invited
|
||||||
*/
|
*/
|
||||||
_waitForMembersIfJoinedAndLL: async function(initial) {
|
_showMembersAccordingToMembershipWithLL: async function() {
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
if (cli.hasLazyLoadMembersEnabled()) {
|
if (cli.hasLazyLoadMembersEnabled()) {
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
const room = cli.getRoom(this.props.roomId);
|
const room = cli.getRoom(this.props.roomId);
|
||||||
if (room && room.getMyMembership() === 'join') {
|
const membership = room && room.getMyMembership();
|
||||||
|
if (membership === "join") {
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
try {
|
try {
|
||||||
await room.loadMembersIfNeeded();
|
await room.loadMembersIfNeeded();
|
||||||
|
@ -108,8 +107,8 @@ module.exports = React.createClass({
|
||||||
this.setState(this._getMembersState(this.roomMembers()));
|
this.setState(this._getMembersState(this.roomMembers()));
|
||||||
this._listenForMembersChanges();
|
this._listenForMembersChanges();
|
||||||
}
|
}
|
||||||
} else if(initial) {
|
} else if (membership === "invite") {
|
||||||
// show the members we've got
|
// show the members we've got when invited
|
||||||
this.setState(this._getMembersState(this.roomMembers()));
|
this.setState(this._getMembersState(this.roomMembers()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,12 +149,12 @@ module.exports = React.createClass({
|
||||||
// We listen for room events because when we accept an invite
|
// We listen for room events because when we accept an invite
|
||||||
// we need to wait till the room is fully populated with state
|
// we need to wait till the room is fully populated with state
|
||||||
// before refreshing the member list else we get a stale list.
|
// before refreshing the member list else we get a stale list.
|
||||||
this._waitForMembersIfJoinedAndLL();
|
this._showMembersAccordingToMembershipWithLL();
|
||||||
},
|
},
|
||||||
|
|
||||||
onMyMembership: function(room, membership, oldMembership) {
|
onMyMembership: function(room, membership, oldMembership) {
|
||||||
if (room.roomId === this.props.roomId && membership === "join") {
|
if (room.roomId === this.props.roomId && membership === "join") {
|
||||||
this._waitForMembersIfJoinedAndLL();
|
this._showMembersAccordingToMembershipWithLL();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue