Fix stopPeeking not being called at the right time

stopPeeking is currently not called when navigating to a joined room
after having peeked a room. This causes the /events endpoint for the
peeked room to be called until peeking another room, even when not
viewing the peeked room anymore.

The current code would only stop peeking if you joining were true (note the nesting),
e.g. when waiting for your join to be confirmed by /sync.

This change might make stopPeeking called also when not needed by there is a guard in
that method to do nothing if not currently peeking.
This commit is contained in:
Bruno Windels 2018-07-12 15:19:25 +02:00
parent b482a4cdd3
commit b412b9e84d

View file

@ -299,11 +299,11 @@ module.exports = React.createClass({
throw err; throw err;
} }
}); });
} else if (room) {
// Stop peeking because we have joined this room previously
MatrixClientPeg.get().stopPeeking();
this.setState({isPeeking: false});
} }
} else if (room) {
// Stop peeking because we have joined this room previously
MatrixClientPeg.get().stopPeeking();
this.setState({isPeeking: false});
} }
}, },