From 98c03869a7af19932d4d4d7ecc9704ede4471bf8 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 24 Jun 2016 15:34:07 +0100 Subject: [PATCH 1/3] Display an error message if room not found Fixes https://github.com/vector-im/vector-web/issues/1012 --- src/components/structures/RoomView.js | 10 +++++--- src/components/views/rooms/RoomPreviewBar.js | 27 +++++++++++++++++--- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 42192107344..78d93511712 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -116,6 +116,7 @@ module.exports = React.createClass({ callState: null, guestsCanJoin: false, canPeek: false, + roomLoadError: null, // this is true if we are fully scrolled-down, and are looking at // the end of the live timeline. It has the effect of hiding the @@ -163,6 +164,7 @@ module.exports = React.createClass({ }, (err) => { this.setState({ roomLoading: false, + roomLoadError: err, }); }); } else { @@ -1282,6 +1284,7 @@ module.exports = React.createClass({ // We have no room object for this room, only the ID. // We've got to this room by following a link, possibly a third party invite. + var room_alias = this.props.roomAddress[0] == '#' ? this.props.roomAddress : null; return (
@@ -1400,7 +1404,7 @@ module.exports = React.createClass({ invitedEmail = this.props.thirdPartyInvite.invitedEmail; } aux = ( - +
+ { error } +
+
+ ); + } + else { + var name = this.props.room ? this.props.room.name : (this.props.room_alias || ""); name = name ? { name } : "a room"; joinBlock = (
From 548c392236078b29121256e5f9c86819bebb0300 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 28 Jun 2016 14:59:45 +0100 Subject: [PATCH 2/3] PR feedback --- src/components/structures/RoomView.js | 3 +++ src/components/views/rooms/RoomPreviewBar.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 78d93511712..776461e0e5e 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -116,6 +116,9 @@ module.exports = React.createClass({ callState: null, guestsCanJoin: false, canPeek: false, + + // If we failed to load information about the room, + // store the error here. roomLoadError: null, // this is true if we are fully scrolled-down, and are looking at diff --git a/src/components/views/rooms/RoomPreviewBar.js b/src/components/views/rooms/RoomPreviewBar.js index f1b15490d7b..2d83b149310 100644 --- a/src/components/views/rooms/RoomPreviewBar.js +++ b/src/components/views/rooms/RoomPreviewBar.js @@ -41,6 +41,9 @@ module.exports = React.createClass({ canPreview: React.PropTypes.bool, spinner: React.PropTypes.bool, room: React.PropTypes.object, + + // The alias that was used to access this room, if appropriate + roomAlias: React.PropTypes.object, }, getDefaultProps: function() { From e8337b21198ed4d4a1c72ffd571736273a6fce55 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 28 Jun 2016 17:11:47 +0100 Subject: [PATCH 3/3] More PR feedback --- src/components/structures/RoomView.js | 1 + src/components/views/rooms/RoomPreviewBar.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 776461e0e5e..7946f723e84 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -117,6 +117,7 @@ module.exports = React.createClass({ guestsCanJoin: false, canPeek: false, + // error object, as from the matrix client/server API // If we failed to load information about the room, // store the error here. roomLoadError: null, diff --git a/src/components/views/rooms/RoomPreviewBar.js b/src/components/views/rooms/RoomPreviewBar.js index 2d83b149310..fee3dd8b4fe 100644 --- a/src/components/views/rooms/RoomPreviewBar.js +++ b/src/components/views/rooms/RoomPreviewBar.js @@ -43,6 +43,8 @@ module.exports = React.createClass({ room: React.PropTypes.object, // The alias that was used to access this room, if appropriate + // If given, this will be how the room is referred to (eg. + // in error messages). roomAlias: React.PropTypes.object, },