mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 14:05:04 +08:00
Display an error message if room not found
Fixes https://github.com/vector-im/vector-web/issues/1012
This commit is contained in:
parent
1c280badde
commit
98c03869a7
@ -116,6 +116,7 @@ module.exports = React.createClass({
|
|||||||
callState: null,
|
callState: null,
|
||||||
guestsCanJoin: false,
|
guestsCanJoin: false,
|
||||||
canPeek: false,
|
canPeek: false,
|
||||||
|
roomLoadError: null,
|
||||||
|
|
||||||
// this is true if we are fully scrolled-down, and are looking at
|
// 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
|
// the end of the live timeline. It has the effect of hiding the
|
||||||
@ -163,6 +164,7 @@ module.exports = React.createClass({
|
|||||||
}, (err) => {
|
}, (err) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
roomLoading: false,
|
roomLoading: false,
|
||||||
|
roomLoadError: err,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -1282,6 +1284,7 @@ module.exports = React.createClass({
|
|||||||
|
|
||||||
// We have no room object for this room, only the ID.
|
// 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.
|
// 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 (
|
return (
|
||||||
<div className="mx_RoomView">
|
<div className="mx_RoomView">
|
||||||
<RoomHeader ref="header"
|
<RoomHeader ref="header"
|
||||||
@ -1292,7 +1295,8 @@ module.exports = React.createClass({
|
|||||||
<div className="mx_RoomView_auxPanel">
|
<div className="mx_RoomView_auxPanel">
|
||||||
<RoomPreviewBar onJoinClick={ this.onJoinButtonClicked }
|
<RoomPreviewBar onJoinClick={ this.onJoinButtonClicked }
|
||||||
onRejectClick={ this.onRejectThreepidInviteButtonClicked }
|
onRejectClick={ this.onRejectThreepidInviteButtonClicked }
|
||||||
canJoin={ true } canPreview={ false }
|
canPreview={ false } error={ this.state.roomLoadError }
|
||||||
|
roomAlias={room_alias}
|
||||||
spinner={this.state.joining}
|
spinner={this.state.joining}
|
||||||
inviterName={inviterName}
|
inviterName={inviterName}
|
||||||
invitedEmail={invitedEmail}
|
invitedEmail={invitedEmail}
|
||||||
@ -1330,7 +1334,7 @@ module.exports = React.createClass({
|
|||||||
<RoomPreviewBar onJoinClick={ this.onJoinButtonClicked }
|
<RoomPreviewBar onJoinClick={ this.onJoinButtonClicked }
|
||||||
onRejectClick={ this.onRejectButtonClicked }
|
onRejectClick={ this.onRejectButtonClicked }
|
||||||
inviterName={ inviterName }
|
inviterName={ inviterName }
|
||||||
canJoin={ true } canPreview={ false }
|
canPreview={ false }
|
||||||
spinner={this.state.joining}
|
spinner={this.state.joining}
|
||||||
room={this.state.room}
|
room={this.state.room}
|
||||||
/>
|
/>
|
||||||
@ -1400,7 +1404,7 @@ module.exports = React.createClass({
|
|||||||
invitedEmail = this.props.thirdPartyInvite.invitedEmail;
|
invitedEmail = this.props.thirdPartyInvite.invitedEmail;
|
||||||
}
|
}
|
||||||
aux = (
|
aux = (
|
||||||
<RoomPreviewBar onJoinClick={this.onJoinButtonClicked} canJoin={true}
|
<RoomPreviewBar onJoinClick={this.onJoinButtonClicked}
|
||||||
onRejectClick={this.onRejectThreepidInviteButtonClicked}
|
onRejectClick={this.onRejectThreepidInviteButtonClicked}
|
||||||
spinner={this.state.joining}
|
spinner={this.state.joining}
|
||||||
inviterName={inviterName}
|
inviterName={inviterName}
|
||||||
|
@ -33,7 +33,11 @@ module.exports = React.createClass({
|
|||||||
|
|
||||||
// If invited by 3rd party invite, the email address the invite was sent to
|
// If invited by 3rd party invite, the email address the invite was sent to
|
||||||
invitedEmail: React.PropTypes.string,
|
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,
|
canPreview: React.PropTypes.bool,
|
||||||
spinner: React.PropTypes.bool,
|
spinner: React.PropTypes.bool,
|
||||||
room: React.PropTypes.object,
|
room: React.PropTypes.object,
|
||||||
@ -42,7 +46,6 @@ module.exports = React.createClass({
|
|||||||
getDefaultProps: function() {
|
getDefaultProps: function() {
|
||||||
return {
|
return {
|
||||||
onJoinClick: function() {},
|
onJoinClick: function() {},
|
||||||
canJoin: false,
|
|
||||||
canPreview: true,
|
canPreview: true,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -115,8 +118,24 @@ module.exports = React.createClass({
|
|||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (this.props.canJoin) {
|
else if (this.props.error) {
|
||||||
var name = this.props.room ? this.props.room.name : "";
|
var name = this.props.roomAlias || "This room";
|
||||||
|
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";
|
name = name ? <b>{ name }</b> : "a room";
|
||||||
joinBlock = (
|
joinBlock = (
|
||||||
<div>
|
<div>
|
||||||
|
Loading…
Reference in New Issue
Block a user