From ba386e3417f5c1d86f46c08c2149a8f8dc1aaf36 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 11 Oct 2017 20:08:09 -0600 Subject: [PATCH] Singularise unsent message prompt, if applicable Adds vector-im/riot-web#1217 Signed-off-by: Travis Ralston --- src/components/structures/RoomStatusBar.js | 7 ++++++- src/components/structures/RoomView.js | 4 +++- src/i18n/strings/en_EN.json | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/structures/RoomStatusBar.js b/src/components/structures/RoomStatusBar.js index 3a2ab33db8..68d25e9a2a 100644 --- a/src/components/structures/RoomStatusBar.js +++ b/src/components/structures/RoomStatusBar.js @@ -39,6 +39,9 @@ module.exports = React.createClass({ // string to display when there are messages in the room which had errors on send unsentMessageError: React.PropTypes.string, + // the number of messages not sent. + numUnsentMessages: React.PropTypes.number, + // this is true if we are fully scrolled-down, and are looking at // the end of the live timeline. atEndOfLiveTimeline: React.PropTypes.bool, @@ -252,6 +255,8 @@ module.exports = React.createClass({ } if (this.props.unsentMessageError) { + let resendStr = "Resend message or cancel message now."; + if (this.props.numUnsentMessages > 1) resendStr = "Resend all or cancel all now. You can also select individual messages to resend or cancel."; return (
/!\ @@ -259,7 +264,7 @@ module.exports = React.createClass({ { this.props.unsentMessageError }
- { _tJsx("Resend all or cancel all now. You can also select individual messages to resend or cancel.", + { _tJsx(resendStr, [/(.*?)<\/a>/, /(.*?)<\/a>/], [ (sub) => { sub }, diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 14273fc95f..9a1eb9ef31 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -748,7 +748,8 @@ module.exports = React.createClass({ for (const event of unsentMessages) { if (!event.error || event.error.name !== "UnknownDeviceError") { - return _t("Some of your messages have not been sent."); + if (unsentMessages.length > 1) return _t("Some of your messages have not been sent."); + return _t("Your message was not sent."); } } return _t("Message not sent due to unknown devices being present"); @@ -1570,6 +1571,7 @@ module.exports = React.createClass({ isStatusAreaExpanded = this.state.statusBarVisible; statusBar = Resend all or cancel all now. You can also select individual messages to resend or cancel.": "Resend all or cancel all now. You can also select individual messages to resend or cancel.", + "Resend message or cancel message now.": "Resend message or cancel message now.", "(~%(count)s results)|one": "(~%(count)s result)", "(~%(count)s results)|other": "(~%(count)s results)", "Cancel": "Cancel",