Disable main address dropdown when lacking permissions

Instead of rendering it as a span with no label.
This commit is contained in:
Travis Ralston 2019-02-21 16:33:02 -07:00
parent 2990cf41e7
commit 58b9a0675e
2 changed files with 27 additions and 35 deletions

View file

@ -186,14 +186,12 @@ export default class AliasSettings extends React.Component {
const EditableItemList = sdk.getComponent("elements.EditableItemList"); const EditableItemList = sdk.getComponent("elements.EditableItemList");
const localDomain = MatrixClientPeg.get().getDomain(); const localDomain = MatrixClientPeg.get().getDomain();
let canonicalAliasSection;
if (this.props.canSetCanonicalAlias) {
let found = false; let found = false;
const canonicalValue = this.state.canonicalAlias || ""; const canonicalValue = this.state.canonicalAlias || "";
canonicalAliasSection = ( const canonicalAliasSection = (
<Field onChange={this.onCanonicalAliasChange} value={canonicalValue} <Field onChange={this.onCanonicalAliasChange} value={canonicalValue}
disabled={this.state.updatingCanonicalAlias} element='select' disabled={this.state.updatingCanonicalAlias || !this.props.canSetCanonicalAlias}
id='canonicalAlias' label={_t('Main address')}> element='select' id='canonicalAlias' label={_t('Main address')}>
<option value="" key="unset">{ _t('not specified') }</option> <option value="" key="unset">{ _t('not specified') }</option>
{ {
Object.keys(this.state.domainToAliases).map((domain, i) => { Object.keys(this.state.domainToAliases).map((domain, i) => {
@ -215,11 +213,6 @@ export default class AliasSettings extends React.Component {
} }
</Field> </Field>
); );
} else {
canonicalAliasSection = (
<b>{ this.state.canonicalAlias || _t('not set') }</b>
);
}
let remoteAliasesSection; let remoteAliasesSection;
if (this.state.remoteDomains.length) { if (this.state.remoteDomains.length) {

View file

@ -814,7 +814,6 @@
"There was an error removing that alias. It may no longer exist or a temporary error occurred.": "There was an error removing that alias. It may no longer exist or a temporary error occurred.", "There was an error removing that alias. It may no longer exist or a temporary error occurred.": "There was an error removing that alias. It may no longer exist or a temporary error occurred.",
"Main address": "Main address", "Main address": "Main address",
"not specified": "not specified", "not specified": "not specified",
"not set": "not set",
"Remote addresses for this room:": "Remote addresses for this room:", "Remote addresses for this room:": "Remote addresses for this room:",
"Local addresses for this room:": "Local addresses for this room:", "Local addresses for this room:": "Local addresses for this room:",
"This room has no local addresses": "This room has no local addresses", "This room has no local addresses": "This room has no local addresses",