From abbc8ffef06dfde98102bc3a02024d5065c03e62 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 26 Aug 2019 11:25:50 -0600 Subject: [PATCH] Adjust copy and include identity server changing when terms are pending Fixes https://github.com/vector-im/riot-web/issues/10636 Fixes https://github.com/vector-im/riot-web/issues/10635 --- src/components/views/settings/SetIdServer.js | 33 ++++++++++++++++--- .../tabs/user/GeneralUserSettingsTab.js | 21 ++++++++---- src/i18n/strings/en_EN.json | 3 ++ 3 files changed, 45 insertions(+), 12 deletions(-) diff --git a/src/components/views/settings/SetIdServer.js b/src/components/views/settings/SetIdServer.js index ba405a5652..55dc3b6e94 100644 --- a/src/components/views/settings/SetIdServer.js +++ b/src/components/views/settings/SetIdServer.js @@ -16,6 +16,7 @@ limitations under the License. import url from 'url'; import React from 'react'; +import PropTypes from 'prop-types'; import {_t} from "../../../languageHandler"; import sdk from '../../../index'; import MatrixClientPeg from "../../../MatrixClientPeg"; @@ -55,6 +56,12 @@ async function checkIdentityServerUrl(u) { } export default class SetIdServer extends React.Component { + static propTypes = { + // Whether or not the ID server is missing terms. This affects the text + // shown to the user. + missingTerms: PropTypes.bool, + }; + constructor() { super(); @@ -274,6 +281,13 @@ export default class SetIdServer extends React.Component { {}, { server: sub => {abbreviateUrl(idServerUrl)} }, ); + if (this.props.missingTerms) { + bodyText = _t( + "If you don't want to use to discover and be discoverable by existing " + + "contacts you know, enter another identity server below.", + {}, {server: sub => {abbreviateUrl(idServerUrl)}}, + ); + } } else { sectionTitle = _t("Identity Server"); bodyText = _t( @@ -286,16 +300,25 @@ export default class SetIdServer extends React.Component { let discoSection; if (idServerUrl) { let discoButtonContent = _t("Disconnect"); + let discoBodyText = _t( + "Disconnecting from your identity server will mean you " + + "won't be discoverable by other users and you won't be " + + "able to invite others by email or phone.", + ); + if (this.props.missingTerms) { + discoBodyText = _t( + "Using an identity server is optional. If you choose not to " + + "use an identity server, you won't be discoverable by other users " + + "and you won't be able to invite others by email or phone.", + ); + discoButtonContent = _t("Do not use an identity server"); + } if (this.state.disconnectBusy) { const InlineSpinner = sdk.getComponent('views.elements.InlineSpinner'); discoButtonContent = ; } discoSection =
- {_t( - "Disconnecting from your identity server will mean you " + - "won't be discoverable by other users and you won't be " + - "able to invite others by email or phone.", - )} + {discoBodyText} {discoButtonContent} diff --git a/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js b/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js index 3d78afd222..9c37730fc5 100644 --- a/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js @@ -249,6 +249,8 @@ export default class GeneralUserSettingsTab extends React.Component { } _renderDiscoverySection() { + const SetIdServer = sdk.getComponent("views.settings.SetIdServer"); + if (this.state.requiredPolicyInfo.hasTerms) { const InlineTermsAgreement = sdk.getComponent("views.terms.InlineTermsAgreement"); const intro = @@ -258,17 +260,22 @@ export default class GeneralUserSettingsTab extends React.Component { {serverName: this.state.idServerName}, )} ; - return ; + return ( +
+ + { /* has its own heading as it includes the current ID server */ } + +
+ ); } const EmailAddresses = sdk.getComponent("views.settings.discovery.EmailAddresses"); const PhoneNumbers = sdk.getComponent("views.settings.discovery.PhoneNumbers"); - const SetIdServer = sdk.getComponent("views.settings.SetIdServer"); const threepidSection = this.state.haveIdServer ?
{_t("Email addresses")} diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index a0c98a0335..1c3c75ebd5 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -559,9 +559,12 @@ "Disconnect": "Disconnect", "Identity Server (%(server)s)": "Identity Server (%(server)s)", "You are currently using to discover and be discoverable by existing contacts you know. You can change your identity server below.": "You are currently using to discover and be discoverable by existing contacts you know. You can change your identity server below.", + "If you don't want to use to discover and be discoverable by existing contacts you know, enter another identity server below.": "If you don't want to use to discover and be discoverable by existing contacts you know, enter another identity server below.", "Identity Server": "Identity Server", "You are not currently using an identity server. To discover and be discoverable by existing contacts you know, add one below.": "You are not currently using an identity server. To discover and be discoverable by existing contacts you know, add one below.", "Disconnecting from your identity server will mean you won't be discoverable by other users and you won't be able to invite others by email or phone.": "Disconnecting from your identity server will mean you won't be discoverable by other users and you won't be able to invite others by email or phone.", + "Using an identity server is optional. If you choose not to use an identity server, you won't be discoverable by other users and you won't be able to invite others by email or phone.": "Using an identity server is optional. If you choose not to use an identity server, you won't be discoverable by other users and you won't be able to invite others by email or phone.", + "Do not use an identity server": "Do not use an identity server", "Enter a new identity server": "Enter a new identity server", "Change": "Change", "Failed to update integration manager": "Failed to update integration manager",