From 9be61497fb33bb3cb52e7e7e631d9b0477b70161 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 25 Feb 2020 16:11:07 -0700 Subject: [PATCH] Handle errors when previewing rooms more safely Fixes https://github.com/vector-im/riot-web/issues/12500 See https://github.com/matrix-org/synapse/issues/6992 for additional context. --- src/components/structures/RoomView.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 0efa46416e..edd916697a 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -342,7 +342,7 @@ export default createReactClass({ peekLoading: false, }); this._onRoomLoaded(room); - }, (err) => { + }).catch((err) => { if (this.unmounted) { return; } @@ -355,7 +355,7 @@ export default createReactClass({ // This won't necessarily be a MatrixError, but we duck-type // here and say if it's got an 'errcode' key with the right value, // it means we can't peek. - if (err.errcode == "M_GUEST_ACCESS_FORBIDDEN") { + if (err.errcode === "M_GUEST_ACCESS_FORBIDDEN" || err.errcode === 'M_FORBIDDEN') { // This is fine: the room just isn't peekable (we assume). this.setState({ peekLoading: false, @@ -365,8 +365,6 @@ export default createReactClass({ } }); } else if (room) { - //viewing a previously joined room, try to lazy load members - // Stop peeking because we have joined this room previously MatrixClientPeg.get().stopPeeking(); this.setState({isPeeking: false});