Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 08339ab

Browse files
authored
Merge pull request #3348 from matrix-org/travis/fix-discovery
Adjust copy and include identity server changing when terms are pending
2 parents 8bdc1e9 + abbc8ff commit 08339ab

File tree

3 files changed

+45
-12
lines changed

3 files changed

+45
-12
lines changed

src/components/views/settings/SetIdServer.js

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ limitations under the License.
1616

1717
import url from 'url';
1818
import React from 'react';
19+
import PropTypes from 'prop-types';
1920
import {_t} from "../../../languageHandler";
2021
import sdk from '../../../index';
2122
import MatrixClientPeg from "../../../MatrixClientPeg";
@@ -55,6 +56,12 @@ async function checkIdentityServerUrl(u) {
5556
}
5657

5758
export default class SetIdServer extends React.Component {
59+
static propTypes = {
60+
// Whether or not the ID server is missing terms. This affects the text
61+
// shown to the user.
62+
missingTerms: PropTypes.bool,
63+
};
64+
5865
constructor() {
5966
super();
6067

@@ -274,6 +281,13 @@ export default class SetIdServer extends React.Component {
274281
{},
275282
{ server: sub => <b>{abbreviateUrl(idServerUrl)}</b> },
276283
);
284+
if (this.props.missingTerms) {
285+
bodyText = _t(
286+
"If you don't want to use <server /> to discover and be discoverable by existing " +
287+
"contacts you know, enter another identity server below.",
288+
{}, {server: sub => <b>{abbreviateUrl(idServerUrl)}</b>},
289+
);
290+
}
277291
} else {
278292
sectionTitle = _t("Identity Server");
279293
bodyText = _t(
@@ -286,16 +300,25 @@ export default class SetIdServer extends React.Component {
286300
let discoSection;
287301
if (idServerUrl) {
288302
let discoButtonContent = _t("Disconnect");
303+
let discoBodyText = _t(
304+
"Disconnecting from your identity server will mean you " +
305+
"won't be discoverable by other users and you won't be " +
306+
"able to invite others by email or phone.",
307+
);
308+
if (this.props.missingTerms) {
309+
discoBodyText = _t(
310+
"Using an identity server is optional. If you choose not to " +
311+
"use an identity server, you won't be discoverable by other users " +
312+
"and you won't be able to invite others by email or phone.",
313+
);
314+
discoButtonContent = _t("Do not use an identity server");
315+
}
289316
if (this.state.disconnectBusy) {
290317
const InlineSpinner = sdk.getComponent('views.elements.InlineSpinner');
291318
discoButtonContent = <InlineSpinner />;
292319
}
293320
discoSection = <div>
294-
<span className="mx_SettingsTab_subsectionText">{_t(
295-
"Disconnecting from your identity server will mean you " +
296-
"won't be discoverable by other users and you won't be " +
297-
"able to invite others by email or phone.",
298-
)}</span>
321+
<span className="mx_SettingsTab_subsectionText">{discoBodyText}</span>
299322
<AccessibleButton onClick={this._onDisconnectClicked} kind="danger_sm">
300323
{discoButtonContent}
301324
</AccessibleButton>

src/components/views/settings/tabs/user/GeneralUserSettingsTab.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ export default class GeneralUserSettingsTab extends React.Component {
249249
}
250250

251251
_renderDiscoverySection() {
252+
const SetIdServer = sdk.getComponent("views.settings.SetIdServer");
253+
252254
if (this.state.requiredPolicyInfo.hasTerms) {
253255
const InlineTermsAgreement = sdk.getComponent("views.terms.InlineTermsAgreement");
254256
const intro = <span className="mx_SettingsTab_subsectionText">
@@ -258,17 +260,22 @@ export default class GeneralUserSettingsTab extends React.Component {
258260
{serverName: this.state.idServerName},
259261
)}
260262
</span>;
261-
return <InlineTermsAgreement
262-
policiesAndServicePairs={this.state.requiredPolicyInfo.policiesAndServices}
263-
agreedUrls={this.state.requiredPolicyInfo.agreedUrls}
264-
onFinished={this.state.requiredPolicyInfo.resolve}
265-
introElement={intro}
266-
/>;
263+
return (
264+
<div>
265+
<InlineTermsAgreement
266+
policiesAndServicePairs={this.state.requiredPolicyInfo.policiesAndServices}
267+
agreedUrls={this.state.requiredPolicyInfo.agreedUrls}
268+
onFinished={this.state.requiredPolicyInfo.resolve}
269+
introElement={intro}
270+
/>
271+
{ /* has its own heading as it includes the current ID server */ }
272+
<SetIdServer missingTerms={true} />
273+
</div>
274+
);
267275
}
268276

269277
const EmailAddresses = sdk.getComponent("views.settings.discovery.EmailAddresses");
270278
const PhoneNumbers = sdk.getComponent("views.settings.discovery.PhoneNumbers");
271-
const SetIdServer = sdk.getComponent("views.settings.SetIdServer");
272279

273280
const threepidSection = this.state.haveIdServer ? <div className='mx_GeneralUserSettingsTab_discovery'>
274281
<span className="mx_SettingsTab_subheading">{_t("Email addresses")}</span>

src/i18n/strings/en_EN.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,9 +559,12 @@
559559
"Disconnect": "Disconnect",
560560
"Identity Server (%(server)s)": "Identity Server (%(server)s)",
561561
"You are currently using <server></server> to discover and be discoverable by existing contacts you know. You can change your identity server below.": "You are currently using <server></server> to discover and be discoverable by existing contacts you know. You can change your identity server below.",
562+
"If you don't want to use <server /> to discover and be discoverable by existing contacts you know, enter another identity server below.": "If you don't want to use <server /> to discover and be discoverable by existing contacts you know, enter another identity server below.",
562563
"Identity Server": "Identity Server",
563564
"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.",
564565
"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.",
566+
"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.",
567+
"Do not use an identity server": "Do not use an identity server",
565568
"Enter a new identity server": "Enter a new identity server",
566569
"Change": "Change",
567570
"Failed to update integration manager": "Failed to update integration manager",

0 commit comments

Comments
 (0)