Merge pull request #4132 from matrix-org/travis/peek-safety
Handle errors when previewing rooms more safely
This commit is contained in:
commit
266832688c
1 changed files with 2 additions and 4 deletions
|
@ -342,7 +342,7 @@ export default createReactClass({
|
||||||
peekLoading: false,
|
peekLoading: false,
|
||||||
});
|
});
|
||||||
this._onRoomLoaded(room);
|
this._onRoomLoaded(room);
|
||||||
}, (err) => {
|
}).catch((err) => {
|
||||||
if (this.unmounted) {
|
if (this.unmounted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -355,7 +355,7 @@ export default createReactClass({
|
||||||
// This won't necessarily be a MatrixError, but we duck-type
|
// 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,
|
// here and say if it's got an 'errcode' key with the right value,
|
||||||
// it means we can't peek.
|
// 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 is fine: the room just isn't peekable (we assume).
|
||||||
this.setState({
|
this.setState({
|
||||||
peekLoading: false,
|
peekLoading: false,
|
||||||
|
@ -365,8 +365,6 @@ export default createReactClass({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (room) {
|
} else if (room) {
|
||||||
//viewing a previously joined room, try to lazy load members
|
|
||||||
|
|
||||||
// Stop peeking because we have joined this room previously
|
// Stop peeking because we have joined this room previously
|
||||||
MatrixClientPeg.get().stopPeeking();
|
MatrixClientPeg.get().stopPeeking();
|
||||||
this.setState({isPeeking: false});
|
this.setState({isPeeking: false});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue