From 1b2fba3fe234fc0e517788b7a4ffb543f4719c64 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 15 Apr 2019 15:22:08 +0200 Subject: [PATCH] move p tags for subtitles out of switch --- src/components/views/rooms/RoomPreviewBar.js | 40 +++++++++----------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/src/components/views/rooms/RoomPreviewBar.js b/src/components/views/rooms/RoomPreviewBar.js index 0e2cc53f9b..2f22ff1513 100644 --- a/src/components/views/rooms/RoomPreviewBar.js +++ b/src/components/views/rooms/RoomPreviewBar.js @@ -226,8 +226,8 @@ module.exports = React.createClass({ switch (joinRule) { case "invite": subTitle = [ -

{_t("Sadly, you can only join it with a working invite.")}

, -

{ errCodeMessage }

, + _t("Sadly, you can only join it with a working invite."), + errCodeMessage, ]; break; case "public": @@ -246,19 +246,16 @@ module.exports = React.createClass({ case MessageCase.InvitedEmailMismatch: { title = _t("The room invite wasn't sent to your account"); const joinRule = this._joinRule(); - switch (joinRule) { - case "public": - subTitle = _t("Luckily, you can still join it because this is a public room."); - primaryActionLabel = _t("Join the discussion"); + if (joinRule === "public") { + subTitle = _t("Luckily, you can still join it because this is a public room."); + primaryActionLabel = _t("Join the discussion"); + primaryActionHandler = this.props.onJoinClick; + } else { + subTitle = _t("Sign in with a different account, ask for another invite, or add the e-mail address %(email)s to this account.", {email: this.props.invitedEmail}); + if (joinRule !== "invite") { + primaryActionLabel = _t("Try to join anyway"); primaryActionHandler = this.props.onJoinClick; - break; - default: - subTitle = _t("Sign in with a different account, ask for another invite, or add the e-mail address %(email)s to this account.", {email: this.props.invitedEmail}); - if (joinRule !== "invite") { - primaryActionLabel = _t("Try to join anyway"); - primaryActionHandler = this.props.onJoinClick; - } - break; + } } break; } @@ -293,12 +290,12 @@ module.exports = React.createClass({ case MessageCase.OtherError: { title = _t("%(roomName)s is not accessible at this time.", {roomName: this._roomName()}); subTitle = ([ -

{ _t("Try again later, or ask a room admin to check if you have access.") }

, -

{ _t("%(errcode)s was returned when trying to access the room.", {errcode: this.props.error.errcode}) }

, -

{ _t("If you think you're seeing this message in error, please submit a bug report.", {}, { + _t("Try again later, or ask a room admin to check if you have access."), + _t("%(errcode)s was returned when trying to access the room.", {errcode: this.props.error.errcode}), + _t("If you think you're seeing this message in error, please submit a bug report.", {}, { issueLink: label => { label }, - }) }

, + }), ]); break; } @@ -308,11 +305,10 @@ module.exports = React.createClass({ let subTitleElements; if (subTitle) { - if (Array.isArray(subTitle)) { - subTitleElements = subTitle; - } else { - subTitleElements = [

{ subTitle }

]; + if (!Array.isArray(subTitle)) { + subTitle = [subTitle]; } + subTitleElements = subTitle.map((t, i) =>

{t}

); } const classes = classNames("mx_RoomPreviewBar", "dark-panel", {