From e1cdbe1e541296fde794025c310092cde78ebfad Mon Sep 17 00:00:00 2001
From: Andy Balaam <andyb@element.io>
Date: Tue, 18 Jan 2022 11:28:23 +0000
Subject: [PATCH] Use IncompatibleController to disable showLocation via labs
 flag (#7566)

---
 src/components/views/rooms/MessageComposer.tsx | 14 ++++----------
 src/settings/Settings.tsx                      |  2 +-
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/components/views/rooms/MessageComposer.tsx b/src/components/views/rooms/MessageComposer.tsx
index 0e1ab93fe8..979377a1ed 100644
--- a/src/components/views/rooms/MessageComposer.tsx
+++ b/src/components/views/rooms/MessageComposer.tsx
@@ -286,10 +286,7 @@ export default class MessageComposer extends React.Component<IProps, IState> {
             showStickers: false,
             showStickersButton: SettingsStore.getValue("MessageComposerInput.showStickersButton"),
             showPollsButton: SettingsStore.getValue("feature_polls"),
-            showLocationButton: (
-                SettingsStore.getValue("feature_location_share") &&
-                SettingsStore.getValue("MessageComposerInput.showLocationButton")
-            ),
+            showLocationButton: SettingsStore.getValue("MessageComposerInput.showLocationButton"),
         };
 
         this.instanceId = instanceCount++;
@@ -354,12 +351,9 @@ export default class MessageComposer extends React.Component<IProps, IState> {
 
                     case "MessageComposerInput.showLocationButton":
                     case "feature_location_share": {
-                        const showLocationButton = (
-                            SettingsStore.getValue("feature_location_share") &&
-                            SettingsStore.getValue(
-                                "MessageComposerInput.showLocationButton",
-                            )
-                        );
+                        const showLocationButton = SettingsStore.getValue(
+                            "MessageComposerInput.showLocationButton");
+
                         if (this.state.showLocationButton !== showLocationButton) {
                             this.setState({ showLocationButton });
                         }
diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx
index 58bebc2821..142559ef10 100644
--- a/src/settings/Settings.tsx
+++ b/src/settings/Settings.tsx
@@ -418,7 +418,7 @@ export const SETTINGS: {[setting: string]: ISetting} = {
         supportedLevels: LEVELS_ACCOUNT_SETTINGS,
         displayName: _td('Enable location sharing'),
         default: true,
-        controller: new UIFeatureController(UIFeature.Widgets, false),
+        controller: new IncompatibleController("feature_location_share", false, false),
     },
     // TODO: Wire up appropriately to UI (FTUE notifications)
     "Notifications.alwaysShowBadgeCounts": {