From b412b9e84d8023d2c4ba5cfac4a28f87b814c74c Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 12 Jul 2018 15:19:25 +0200 Subject: [PATCH] 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. --- src/components/structures/RoomView.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 98d700e0a0..b9d0843635 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -299,11 +299,11 @@ module.exports = React.createClass({ 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}); } },