From f9a2b76966e2f7762840d8bef87269ccaef41e56 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 16 Apr 2019 17:50:20 +0200 Subject: [PATCH] show room name where available when header isn't visible (no preview) --- src/components/views/rooms/RoomPreviewBar.js | 24 ++++++++++++++------ src/i18n/strings/en_EN.json | 9 ++++---- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/components/views/rooms/RoomPreviewBar.js b/src/components/views/rooms/RoomPreviewBar.js index 47dbd0c178..a9805f9f18 100644 --- a/src/components/views/rooms/RoomPreviewBar.js +++ b/src/components/views/rooms/RoomPreviewBar.js @@ -177,8 +177,15 @@ module.exports = React.createClass({ } }, - _roomName: function() { - return this.props.room ? this.props.room.name : (this.props.room_alias || _t("This room")); + _roomName: function(atStart = false) { + const name = this.props.room ? this.props.room.name : this.props.room_alias; + if (name) { + return name; + } else if (atStart) { + return _t("This room"); + } else { + return _t("this room"); + } }, onLoginClick: function() { @@ -226,7 +233,8 @@ module.exports = React.createClass({ } case MessageCase.Kicked: { const {memberName, reason} = this._getKickOrBanInfo(); - title = _t("You were kicked from this room by %(memberName)s", {memberName}); + title = _t("You were kicked from %(roomName)s by %(memberName)s", + {memberName, roomName: this._roomName()}); subTitle = _t("Reason: %(reason)s", {reason}); if (this._joinRule() === "invite") { @@ -242,7 +250,8 @@ module.exports = React.createClass({ } case MessageCase.Banned: { const {memberName, reason} = this._getKickOrBanInfo(); - title = _t("You were banned from this room by %(memberName)s", {memberName}); + title = _t("You were banned from %(roomName)s by %(memberName)s", + {memberName, roomName: this._roomName()}); subTitle = _t("Reason: %(reason)s", {reason}); primaryActionLabel = _t("Forget this room"); primaryActionHandler = this.props.onForgetClick; @@ -307,19 +316,20 @@ module.exports = React.createClass({ if (this.props.canPreview) { title = _t("You're previewing this room. Want to join it?"); } else { - title = _t("This room can't be previewed. Do you want to join it?"); + title = _t("%(roomName)s can't be previewed. Do you want to join it?", + {roomName: this._roomName(true)}); } primaryActionLabel = _t("Join the discussion"); primaryActionHandler = this.props.onJoinClick; break; } case MessageCase.RoomNotFound: { - title = _t("%(roomName)s does not exist.", {roomName: this._roomName()}); + title = _t("%(roomName)s does not exist.", {roomName: this._roomName(true)}); subTitle = _t("This room doesn't exist. Are you sure you're at the right place?"); break; } case MessageCase.OtherError: { - title = _t("%(roomName)s is not accessible at this time.", {roomName: this._roomName()}); + title = _t("%(roomName)s is not accessible at this time.", {roomName: this._roomName(true)}); subTitle = [ _t("Try again later, or ask a room admin to check if you have access."), _t("%(errcode)s was returned while trying to access the room. If you think you're seeing this message in error, please submit a bug report.", diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 2686012029..c156da40bc 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -790,17 +790,18 @@ "Historical": "Historical", "System Alerts": "System Alerts", "This room": "This room", + "this room": "this room", "Joining room …": "Joining room …", "Loading …": "Loading …", "Rejecting invite …": "Rejecting invite …", "Join the conversation with an account": "Join the conversation with an account", "Sign Up": "Sign Up", "Sign In": "Sign In", - "You were kicked from this room by %(memberName)s": "You were kicked from this room by %(memberName)s", + "You were kicked from %(roomName)s by %(memberName)s": "You were kicked from %(roomName)s by %(memberName)s", "Reason: %(reason)s": "Reason: %(reason)s", - "Re-join": "Re-join", "Forget this room": "Forget this room", - "You were banned from this room by %(memberName)s": "You were banned from this room by %(memberName)s", + "Re-join": "Re-join", + "You were banned from %(roomName)s by %(memberName)s": "You were banned from %(roomName)s by %(memberName)s", "Something went wrong with your invite to this room": "Something went wrong with your invite to this room", "%(errcode)s was returned while trying to valide your invite. You could try to pass this information on to a room admin.": "%(errcode)s was returned while trying to valide your invite. You could try to pass this information on to a room admin.", "You can only join it with a working invite.": "You can only join it with a working invite.", @@ -814,7 +815,7 @@ "%(memberName)s invited you": "%(memberName)s invited you", "Reject": "Reject", "You're previewing this room. Want to join it?": "You're previewing this room. Want to join it?", - "This room can't be previewed. Do you want to join it?": "This room can't be previewed. Do you want to join it?", + "%(roomName)s can't be previewed. Do you want to join it?": "%(roomName)s can't be previewed. Do you want to join it?", "%(roomName)s does not exist.": "%(roomName)s does not exist.", "This room doesn't exist. Are you sure you're at the right place?": "This room doesn't exist. Are you sure you're at the right place?", "%(roomName)s is not accessible at this time.": "%(roomName)s is not accessible at this time.",