show better error msg after UnkDevDialog
should fix https://github.com/vector-im/riot-web/issues/3122pull/21833/head
parent
cd5a1abfac
commit
e825a4af3c
|
@ -39,8 +39,8 @@ module.exports = React.createClass({
|
||||||
// the number of messages which have arrived since we've been scrolled up
|
// the number of messages which have arrived since we've been scrolled up
|
||||||
numUnreadMessages: React.PropTypes.number,
|
numUnreadMessages: React.PropTypes.number,
|
||||||
|
|
||||||
// true if there are messages in the room which had errors on send
|
// string to display when there are messages in the room which had errors on send
|
||||||
hasUnsentMessages: React.PropTypes.bool,
|
unsentMessageError: React.PropTypes.string,
|
||||||
|
|
||||||
// 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.
|
// the end of the live timeline.
|
||||||
|
@ -160,7 +160,7 @@ module.exports = React.createClass({
|
||||||
return STATUS_BAR_EXPANDED;
|
return STATUS_BAR_EXPANDED;
|
||||||
} else if (props.tabCompleteEntries) {
|
} else if (props.tabCompleteEntries) {
|
||||||
return STATUS_BAR_HIDDEN;
|
return STATUS_BAR_HIDDEN;
|
||||||
} else if (props.hasUnsentMessages) {
|
} else if (props.unsentMessageError) {
|
||||||
return STATUS_BAR_EXPANDED_LARGE;
|
return STATUS_BAR_EXPANDED_LARGE;
|
||||||
}
|
}
|
||||||
return STATUS_BAR_HIDDEN;
|
return STATUS_BAR_HIDDEN;
|
||||||
|
@ -288,12 +288,12 @@ module.exports = React.createClass({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.props.hasUnsentMessages) {
|
if (this.props.unsentMessageError) {
|
||||||
return (
|
return (
|
||||||
<div className="mx_RoomStatusBar_connectionLostBar">
|
<div className="mx_RoomStatusBar_connectionLostBar">
|
||||||
<img src="img/warning.svg" width="24" height="23" title="/!\ " alt="/!\ "/>
|
<img src="img/warning.svg" width="24" height="23" title="/!\ " alt="/!\ "/>
|
||||||
<div className="mx_RoomStatusBar_connectionLostBar_title">
|
<div className="mx_RoomStatusBar_connectionLostBar_title">
|
||||||
Some of your messages have not been sent.
|
{ this.props.unsentMessageError }
|
||||||
</div>
|
</div>
|
||||||
<div className="mx_RoomStatusBar_connectionLostBar_desc">
|
<div className="mx_RoomStatusBar_connectionLostBar_desc">
|
||||||
<a className="mx_RoomStatusBar_resend_link"
|
<a className="mx_RoomStatusBar_resend_link"
|
||||||
|
|
|
@ -128,7 +128,7 @@ module.exports = React.createClass({
|
||||||
draggingFile: false,
|
draggingFile: false,
|
||||||
searching: false,
|
searching: false,
|
||||||
searchResults: null,
|
searchResults: null,
|
||||||
hasUnsentMessages: false,
|
unsentMessageError: '',
|
||||||
callState: null,
|
callState: null,
|
||||||
guestsCanJoin: false,
|
guestsCanJoin: false,
|
||||||
canPeek: false,
|
canPeek: false,
|
||||||
|
@ -182,7 +182,7 @@ module.exports = React.createClass({
|
||||||
room: room,
|
room: room,
|
||||||
roomId: result.room_id,
|
roomId: result.room_id,
|
||||||
roomLoading: !room,
|
roomLoading: !room,
|
||||||
hasUnsentMessages: this._hasUnsentMessages(room),
|
unsentMessageError: this._getUnsentMessageError(room),
|
||||||
}, this._onHaveRoom);
|
}, this._onHaveRoom);
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -196,7 +196,7 @@ module.exports = React.createClass({
|
||||||
roomId: this.props.roomAddress,
|
roomId: this.props.roomAddress,
|
||||||
room: room,
|
room: room,
|
||||||
roomLoading: !room,
|
roomLoading: !room,
|
||||||
hasUnsentMessages: this._hasUnsentMessages(room),
|
unsentMessageError: this._getUnsentMessageError(room),
|
||||||
}, this._onHaveRoom);
|
}, this._onHaveRoom);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -397,7 +397,7 @@ module.exports = React.createClass({
|
||||||
case 'message_sent':
|
case 'message_sent':
|
||||||
case 'message_send_cancelled':
|
case 'message_send_cancelled':
|
||||||
this.setState({
|
this.setState({
|
||||||
hasUnsentMessages: this._hasUnsentMessages(this.state.room)
|
unsentMessageError: this._getUnsentMessageError(this.state.room),
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'notifier_enabled':
|
case 'notifier_enabled':
|
||||||
|
@ -636,8 +636,15 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
}, 500),
|
}, 500),
|
||||||
|
|
||||||
_hasUnsentMessages: function(room) {
|
_getUnsentMessageError: function(room) {
|
||||||
return this._getUnsentMessages(room).length > 0;
|
const unsentMessages = this._getUnsentMessages(room);
|
||||||
|
if (!unsentMessages.length) return "";
|
||||||
|
for (const event of unsentMessages) {
|
||||||
|
if (!event.error || event.error.name !== "UnknownDeviceError") {
|
||||||
|
return "Some of your messages have not been sent.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "Message not sent due to unknown devices being present";
|
||||||
},
|
},
|
||||||
|
|
||||||
_getUnsentMessages: function(room) {
|
_getUnsentMessages: function(room) {
|
||||||
|
@ -1521,7 +1528,7 @@ module.exports = React.createClass({
|
||||||
room={this.state.room}
|
room={this.state.room}
|
||||||
tabComplete={this.tabComplete}
|
tabComplete={this.tabComplete}
|
||||||
numUnreadMessages={this.state.numUnreadMessages}
|
numUnreadMessages={this.state.numUnreadMessages}
|
||||||
hasUnsentMessages={this.state.hasUnsentMessages}
|
unsentMessageError={this.state.unsentMessageError}
|
||||||
atEndOfLiveTimeline={this.state.atEndOfLiveTimeline}
|
atEndOfLiveTimeline={this.state.atEndOfLiveTimeline}
|
||||||
hasActiveCall={inCall}
|
hasActiveCall={inCall}
|
||||||
onResendAllClick={this.onResendAllClick}
|
onResendAllClick={this.onResendAllClick}
|
||||||
|
|
Loading…
Reference in New Issue