From 58b9a0675e3aa2be625500a31c80830aa5e1eeef Mon Sep 17 00:00:00 2001
From: Travis Ralston <travpc@gmail.com>
Date: Thu, 21 Feb 2019 16:33:02 -0700
Subject: [PATCH] Disable main address dropdown when lacking permissions

Instead of rendering it as a span with no label.
---
 .../views/room_settings/AliasSettings.js      | 61 ++++++++-----------
 src/i18n/strings/en_EN.json                   |  1 -
 2 files changed, 27 insertions(+), 35 deletions(-)

diff --git a/src/components/views/room_settings/AliasSettings.js b/src/components/views/room_settings/AliasSettings.js
index d6a6b608e2..4859174b28 100644
--- a/src/components/views/room_settings/AliasSettings.js
+++ b/src/components/views/room_settings/AliasSettings.js
@@ -186,40 +186,33 @@ export default class AliasSettings extends React.Component {
         const EditableItemList = sdk.getComponent("elements.EditableItemList");
         const localDomain = MatrixClientPeg.get().getDomain();
 
-        let canonicalAliasSection;
-        if (this.props.canSetCanonicalAlias) {
-            let found = false;
-            const canonicalValue = this.state.canonicalAlias || "";
-            canonicalAliasSection = (
-                <Field onChange={this.onCanonicalAliasChange} value={canonicalValue}
-                       disabled={this.state.updatingCanonicalAlias} element='select'
-                       id='canonicalAlias' label={_t('Main address')}>
-                    <option value="" key="unset">{ _t('not specified') }</option>
-                    {
-                        Object.keys(this.state.domainToAliases).map((domain, i) => {
-                            return this.state.domainToAliases[domain].map((alias, j) => {
-                                if (alias === this.state.canonicalAlias) found = true;
-                                return (
-                                    <option value={alias} key={i + "_" + j}>
-                                        { alias }
-                                    </option>
-                                );
-                            });
-                        })
-                    }
-                    {
-                        found || !this.state.canonicalAlias ? '' :
-                        <option value={ this.state.canonicalAlias } key='arbitrary'>
-                            { this.state.canonicalAlias }
-                        </option>
-                    }
-                </Field>
-            );
-        } else {
-            canonicalAliasSection = (
-                <b>{ this.state.canonicalAlias || _t('not set') }</b>
-            );
-        }
+        let found = false;
+        const canonicalValue = this.state.canonicalAlias || "";
+        const canonicalAliasSection = (
+            <Field onChange={this.onCanonicalAliasChange} value={canonicalValue}
+                   disabled={this.state.updatingCanonicalAlias || !this.props.canSetCanonicalAlias}
+                   element='select' id='canonicalAlias' label={_t('Main address')}>
+                <option value="" key="unset">{ _t('not specified') }</option>
+                {
+                    Object.keys(this.state.domainToAliases).map((domain, i) => {
+                        return this.state.domainToAliases[domain].map((alias, j) => {
+                            if (alias === this.state.canonicalAlias) found = true;
+                            return (
+                                <option value={alias} key={i + "_" + j}>
+                                    { alias }
+                                </option>
+                            );
+                        });
+                    })
+                }
+                {
+                    found || !this.state.canonicalAlias ? '' :
+                    <option value={ this.state.canonicalAlias } key='arbitrary'>
+                        { this.state.canonicalAlias }
+                    </option>
+                }
+            </Field>
+        );
 
         let remoteAliasesSection;
         if (this.state.remoteDomains.length) {
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index b74f14a99e..c32b604f7e 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -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.",
     "Main address": "Main address",
     "not specified": "not specified",
-    "not set": "not set",
     "Remote addresses for this room:": "Remote 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",