-
-
Notifications
You must be signed in to change notification settings - Fork 832
Display an error message if room not found #325
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,6 +117,11 @@ 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, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please can we include comments which document wtf these mean? |
||
|
||
// 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 | ||
// 'scroll to bottom' knob, among a couple of other things. | ||
|
@@ -163,6 +168,7 @@ module.exports = React.createClass({ | |
}, (err) => { | ||
this.setState({ | ||
roomLoading: false, | ||
roomLoadError: err, | ||
}); | ||
}); | ||
} else { | ||
|
@@ -1282,6 +1288,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 ( | ||
<div className="mx_RoomView"> | ||
<RoomHeader ref="header" | ||
|
@@ -1292,7 +1299,8 @@ module.exports = React.createClass({ | |
<div className="mx_RoomView_auxPanel"> | ||
<RoomPreviewBar onJoinClick={ this.onJoinButtonClicked } | ||
onRejectClick={ this.onRejectThreepidInviteButtonClicked } | ||
canJoin={ true } canPreview={ false } | ||
canPreview={ false } error={ this.state.roomLoadError } | ||
roomAlias={room_alias} | ||
spinner={this.state.joining} | ||
inviterName={inviterName} | ||
invitedEmail={invitedEmail} | ||
|
@@ -1330,7 +1338,7 @@ module.exports = React.createClass({ | |
<RoomPreviewBar onJoinClick={ this.onJoinButtonClicked } | ||
onRejectClick={ this.onRejectButtonClicked } | ||
inviterName={ inviterName } | ||
canJoin={ true } canPreview={ false } | ||
canPreview={ false } | ||
spinner={this.state.joining} | ||
room={this.state.room} | ||
/> | ||
|
@@ -1400,7 +1408,7 @@ module.exports = React.createClass({ | |
invitedEmail = this.props.thirdPartyInvite.invitedEmail; | ||
} | ||
aux = ( | ||
<RoomPreviewBar onJoinClick={this.onJoinButtonClicked} canJoin={true} | ||
<RoomPreviewBar onJoinClick={this.onJoinButtonClicked} | ||
onRejectClick={this.onRejectThreepidInviteButtonClicked} | ||
spinner={this.state.joining} | ||
inviterName={inviterName} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,16 +33,24 @@ module.exports = React.createClass({ | |
|
||
// If invited by 3rd party invite, the email address the invite was sent to | ||
invitedEmail: React.PropTypes.string, | ||
canJoin: React.PropTypes.bool, | ||
|
||
// A standard client/server API error object. If supplied, indicates that the | ||
// caller was unable to fetch details about the room for the given reason. | ||
error: React.PropTypes.object, | ||
|
||
canPreview: React.PropTypes.bool, | ||
spinner: React.PropTypes.bool, | ||
room: React.PropTypes.object, | ||
|
||
// The alias that was used to access this room, if appropriate | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might also be worth recording what it is used for (ie, sticking into error messages). I wondered if it might actually be better called roomName (since, from the POV of |
||
// If given, this will be how the room is referred to (eg. | ||
// in error messages). | ||
roomAlias: React.PropTypes.object, | ||
}, | ||
|
||
getDefaultProps: function() { | ||
return { | ||
onJoinClick: function() {}, | ||
canJoin: false, | ||
canPreview: true, | ||
}; | ||
}, | ||
|
@@ -115,8 +123,24 @@ module.exports = React.createClass({ | |
); | ||
|
||
} | ||
else if (this.props.canJoin) { | ||
var name = this.props.room ? this.props.room.name : ""; | ||
else if (this.props.error) { | ||
var name = this.props.roomAlias || "This room"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
var error; | ||
if (this.props.error.errcode == 'M_NOT_FOUND') { | ||
error = name + " does not exist"; | ||
} else { | ||
error = name + " is not accessible at this time"; | ||
} | ||
joinBlock = ( | ||
<div> | ||
<div className="mx_RoomPreviewBar_join_text"> | ||
{ error } | ||
</div> | ||
</div> | ||
); | ||
} | ||
else { | ||
var name = this.props.room ? this.props.room.name : (this.props.room_alias || ""); | ||
name = name ? <b>{ name }</b> : "a room"; | ||
joinBlock = ( | ||
<div> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string? something else?