From 25351d552eeebaa7ff5423478288e067af67b56b Mon Sep 17 00:00:00 2001
From: "J. Ryan Stinnett" <jryans@gmail.com>
Date: Wed, 17 Jul 2019 16:56:15 +0100
Subject: [PATCH] Remove editing feature flag

Part of https://github.com/vector-im/riot-web/issues/10282
---
 src/MatrixClientPeg.js                             | 5 +----
 src/components/structures/MessagePanel.js          | 3 +--
 src/components/views/messages/MessageActionBar.js  | 6 +-----
 src/components/views/rooms/EventTile.js            | 2 +-
 src/components/views/rooms/MessageComposerInput.js | 5 ++---
 src/i18n/strings/en_EN.json                        | 1 -
 src/settings/Settings.js                           | 6 ------
 src/shouldHideEvent.js                             | 2 +-
 8 files changed, 7 insertions(+), 23 deletions(-)

diff --git a/src/MatrixClientPeg.js b/src/MatrixClientPeg.js
index b2a63efd4c..d2760bc82c 100644
--- a/src/MatrixClientPeg.js
+++ b/src/MatrixClientPeg.js
@@ -208,9 +208,6 @@ class MatrixClientPeg {
     }
 
     _createClient(creds: MatrixClientCreds) {
-        const aggregateRelations = SettingsStore.isFeatureEnabled("feature_reactions");
-        const enableEdits = SettingsStore.isFeatureEnabled("feature_message_editing");
-
         const opts = {
             baseUrl: creds.homeserverUrl,
             idBaseUrl: creds.identityServerUrl,
@@ -220,7 +217,7 @@ class MatrixClientPeg {
             timelineSupport: true,
             forceTURN: !SettingsStore.getValue('webRtcAllowPeerToPeer', false),
             verificationMethods: [verificationMethods.SAS],
-            unstableClientRelationAggregation: aggregateRelations || enableEdits,
+            unstableClientRelationAggregation: true,
         };
 
         this.matrixClient = createMatrixClient(opts);
diff --git a/src/components/structures/MessagePanel.js b/src/components/structures/MessagePanel.js
index 37a8a2d4c9..1fb0d6c725 100644
--- a/src/components/structures/MessagePanel.js
+++ b/src/components/structures/MessagePanel.js
@@ -110,7 +110,6 @@ module.exports = React.createClass({
     },
 
     componentWillMount: function() {
-        this._editingEnabled = SettingsStore.isFeatureEnabled("feature_message_editing");
         // the event after which we put a visible unread marker on the last
         // render cycle; null if readMarkerVisible was false or the RM was
         // suppressed (eg because it was at the end of the timeline)
@@ -586,7 +585,7 @@ module.exports = React.createClass({
                 <EventTile mxEvent={mxEv}
                     continuation={continuation}
                     isRedacted={mxEv.isRedacted()}
-                    replacingEventId={this._editingEnabled && mxEv.replacingEventId()}
+                    replacingEventId={mxEv.replacingEventId()}
                     editState={isEditing && this.props.editState}
                     onHeightChanged={this._onHeightChanged}
                     readReceipts={readReceipts}
diff --git a/src/components/views/messages/MessageActionBar.js b/src/components/views/messages/MessageActionBar.js
index e7843c1505..4a0d4d5b07 100644
--- a/src/components/views/messages/MessageActionBar.js
+++ b/src/components/views/messages/MessageActionBar.js
@@ -127,10 +127,6 @@ export default class MessageActionBar extends React.PureComponent {
         return SettingsStore.isFeatureEnabled("feature_reactions");
     }
 
-    isEditingEnabled() {
-        return SettingsStore.isFeatureEnabled("feature_message_editing");
-    }
-
     renderReactButton() {
         if (!this.isReactionsEnabled()) {
             return null;
@@ -158,7 +154,7 @@ export default class MessageActionBar extends React.PureComponent {
                 onClick={this.onReplyClick}
             />;
         }
-        if (this.isEditingEnabled() && canEditContent(this.props.mxEvent)) {
+        if (canEditContent(this.props.mxEvent)) {
             editButton = <span className="mx_MessageActionBar_maskButton mx_MessageActionBar_editButton"
                 title={_t("Edit")}
                 onClick={this.onEditClick}
diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js
index 192e203f35..ee1147c062 100644
--- a/src/components/views/rooms/EventTile.js
+++ b/src/components/views/rooms/EventTile.js
@@ -829,7 +829,7 @@ module.exports.haveTileForEvent = function(e) {
     if (e.isRedacted() && !isMessageEvent(e)) return false;
 
     // No tile for replacement events since they update the original tile
-    if (e.isRelation("m.replace") && SettingsStore.isFeatureEnabled("feature_message_editing")) return false;
+    if (e.isRelation("m.replace")) return false;
 
     const handler = getHandlerTile(e);
     if (handler === undefined) return false;
diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js
index 45a27c4253..d182ed4205 100644
--- a/src/components/views/rooms/MessageComposerInput.js
+++ b/src/components/views/rooms/MessageComposerInput.js
@@ -1141,9 +1141,8 @@ export default class MessageComposerInput extends React.Component {
             if (!selection.anchor.isAtEndOfNode(document)) return;
         }
 
-        const editingEnabled = SettingsStore.isFeatureEnabled("feature_message_editing");
-        const shouldSelectHistory = (editingEnabled && e.altKey) || !editingEnabled;
-        const shouldEditLastMessage = editingEnabled && !e.altKey && up && !RoomViewStore.getQuotingEvent();
+        const shouldSelectHistory = e.altKey;
+        const shouldEditLastMessage = !e.altKey && up && !RoomViewStore.getQuotingEvent();
 
         if (shouldSelectHistory) {
             // Try select composer history
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index df470710c9..db90ddf66c 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -315,7 +315,6 @@
     "Custom user status messages": "Custom user status messages",
     "Group & filter rooms by custom tags (refresh to apply changes)": "Group & filter rooms by custom tags (refresh to apply changes)",
     "Render simple counters in room header": "Render simple counters in room header",
-    "Edit messages after they have been sent (refresh to apply changes)": "Edit messages after they have been sent (refresh to apply changes)",
     "React to messages with emoji (refresh to apply changes)": "React to messages with emoji (refresh to apply changes)",
     "Enable Emoji suggestions while typing": "Enable Emoji suggestions while typing",
     "Use compact timeline layout": "Use compact timeline layout",
diff --git a/src/settings/Settings.js b/src/settings/Settings.js
index f07cf891b9..c6cc089078 100644
--- a/src/settings/Settings.js
+++ b/src/settings/Settings.js
@@ -114,12 +114,6 @@ export const SETTINGS = {
         supportedLevels: LEVELS_FEATURE,
         default: false,
     },
-    "feature_message_editing": {
-        isFeature: true,
-        displayName: _td("Edit messages after they have been sent (refresh to apply changes)"),
-        supportedLevels: LEVELS_FEATURE,
-        default: true,
-    },
     "feature_reactions": {
         isFeature: true,
         displayName: _td("React to messages with emoji (refresh to apply changes)"),
diff --git a/src/shouldHideEvent.js b/src/shouldHideEvent.js
index 7a98c0dba6..b1533ae835 100644
--- a/src/shouldHideEvent.js
+++ b/src/shouldHideEvent.js
@@ -47,7 +47,7 @@ export default function shouldHideEvent(ev) {
     if (ev.isRedacted() && !isEnabled('showRedactions')) return true;
 
     // Hide replacement events since they update the original tile (if enabled)
-    if (ev.isRelation("m.replace") && SettingsStore.isFeatureEnabled("feature_message_editing")) return true;
+    if (ev.isRelation("m.replace")) return true;
 
     const eventDiff = memberEventDiff(ev);