Fix PR feedback

This commit is contained in:
David Baker 2016-06-20 18:05:58 +01:00
parent 4d5fbfc5b1
commit 4c214119b2
2 changed files with 18 additions and 14 deletions

View file

@ -191,8 +191,12 @@ module.exports = React.createClass({
// NB. We peek if we are not in the room, although if we try to peek into
// a room in which we have a member event (ie. we've left) synapse will just
// send us the same data as we get in the sync (ie. the last events we saw).
var my_member = this.state.room ? this.state.room.getMember(MatrixClientPeg.get().credentials.userId) : null;
var user_is_in_room = my_member ? my_member.membership == 'join' : false;
var user_is_in_room = null;
if (this.state.room) {
user_is_in_room = this.state.room.hasMembershipState(
MatrixClientPeg.get().credentials.userId, 'join'
);
}
if (!user_is_in_room && this.state.roomId) {
if (this.props.autoJoin) {
@ -1003,7 +1007,7 @@ module.exports = React.createClass({
this.setState({
rejecting: true
});
MatrixClientPeg.get().leave(this.props.roomId).done(function() {
MatrixClientPeg.get().leave(this.state.roomId).done(function() {
dis.dispatch({ action: 'view_next_room' });
self.setState({
rejecting: false