Merge pull request #3323 from matrix-org/dbkr/add_3pid_without_is

Allow 3pids to be added with no ID server set
This commit is contained in:
David Baker 2019-08-19 17:02:56 +01:00 committed by GitHub
commit 6879ddd34c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,11 +46,17 @@ export default class GeneralUserSettingsTab extends React.Component {
language: languageHandler.getCurrentLanguage(), language: languageHandler.getCurrentLanguage(),
theme: SettingsStore.getValueAt(SettingLevel.ACCOUNT, "theme"), theme: SettingsStore.getValueAt(SettingLevel.ACCOUNT, "theme"),
haveIdServer: Boolean(MatrixClientPeg.get().getIdentityServerUrl()), haveIdServer: Boolean(MatrixClientPeg.get().getIdentityServerUrl()),
serverRequiresIdServer: null,
}; };
this.dispatcherRef = dis.register(this._onAction); this.dispatcherRef = dis.register(this._onAction);
} }
async componentWillMount() {
const serverRequiresIdServer = await MatrixClientPeg.get().doesServerRequireIdServerParam();
this.setState({serverRequiresIdServer});
}
componentWillUnmount() { componentWillUnmount() {
dis.unregister(this.dispatcherRef); dis.unregister(this.dispatcherRef);
} }
@ -127,6 +133,7 @@ export default class GeneralUserSettingsTab extends React.Component {
const ChangePassword = sdk.getComponent("views.settings.ChangePassword"); const ChangePassword = sdk.getComponent("views.settings.ChangePassword");
const EmailAddresses = sdk.getComponent("views.settings.account.EmailAddresses"); const EmailAddresses = sdk.getComponent("views.settings.account.EmailAddresses");
const PhoneNumbers = sdk.getComponent("views.settings.account.PhoneNumbers"); const PhoneNumbers = sdk.getComponent("views.settings.account.PhoneNumbers");
const Spinner = sdk.getComponent("views.elements.Spinner");
const passwordChangeForm = ( const passwordChangeForm = (
<ChangePassword <ChangePassword
@ -137,13 +144,19 @@ export default class GeneralUserSettingsTab extends React.Component {
onFinished={this._onPasswordChanged} /> onFinished={this._onPasswordChanged} />
); );
const threepidSection = this.state.haveIdServer ? <div> let threepidSection = null;
if (this.state.haveIdServer || this.state.serverRequiresIdServer === false) {
threepidSection = <div>
<span className="mx_SettingsTab_subheading">{_t("Email addresses")}</span> <span className="mx_SettingsTab_subheading">{_t("Email addresses")}</span>
<EmailAddresses /> <EmailAddresses />
<span className="mx_SettingsTab_subheading">{_t("Phone numbers")}</span> <span className="mx_SettingsTab_subheading">{_t("Phone numbers")}</span>
<PhoneNumbers /> <PhoneNumbers />
</div> : null; </div>;
} else if (this.state.serverRequiresIdServer === null) {
threepidSection = <Spinner />;
}
return ( return (
<div className="mx_SettingsTab_section mx_GeneralUserSettingsTab_accountSection"> <div className="mx_SettingsTab_section mx_GeneralUserSettingsTab_accountSection">