From 41b995df3c9b54abfc740e71e71b9ad1874ea7ee Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 13 Jun 2019 22:56:32 +0100 Subject: [PATCH 01/31] If oldContent matches newContent, skip sending the edit Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/elements/MessageEditor.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/components/views/elements/MessageEditor.js b/src/components/views/elements/MessageEditor.js index 0aff6781ee..72091f2e1c 100644 --- a/src/components/views/elements/MessageEditor.js +++ b/src/components/views/elements/MessageEditor.js @@ -166,6 +166,17 @@ export default class MessageEditor extends React.Component { contentBody.format = newContent.format; contentBody.formatted_body = ` * ${newContent.formatted_body}`; } + + // if nothing has changed then bail + const oldContent = this.props.editState.getEvent().getContent(); + if (oldContent["msgtype"] === newContent["msgtype"] && oldContent["body"] === newContent["body"] && + oldContent["format"] === newContent["format"] && + oldContent["formatted_body"] === newContent["formatted_body"]) { + console.log("skipping"); + this._cancelEdit(); + return; + } + const content = Object.assign({ "m.new_content": newContent, "m.relates_to": { From e591d3ef76828179bac3db5d13fcb73ecb90d34a Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sat, 29 Jun 2019 06:52:19 +0100 Subject: [PATCH 02/31] take dirty-flag into account for editing Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/elements/MessageEditor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/views/elements/MessageEditor.js b/src/components/views/elements/MessageEditor.js index ce22bf2fc6..4f1bcea971 100644 --- a/src/components/views/elements/MessageEditor.js +++ b/src/components/views/elements/MessageEditor.js @@ -189,10 +189,10 @@ export default class MessageEditor extends React.Component { // if nothing has changed then bail const oldContent = this.props.editState.getEvent().getContent(); - if (oldContent["msgtype"] === newContent["msgtype"] && oldContent["body"] === newContent["body"] && + if (!this._hasModifications || + (oldContent["msgtype"] === newContent["msgtype"] && oldContent["body"] === newContent["body"] && oldContent["format"] === newContent["format"] && - oldContent["formatted_body"] === newContent["formatted_body"]) { - console.log("skipping"); + oldContent["formatted_body"] === newContent["formatted_body"])) { this._cancelEdit(); return; } From d774d96290e954ad126f27e688cbb6693cf38d3f Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sun, 30 Jun 2019 10:41:39 +0100 Subject: [PATCH 03/31] Fix some React errors Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/elements/EditableItemList.js | 8 ++++---- .../settings/tabs/user/PreferencesUserSettingsTab.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/views/elements/EditableItemList.js b/src/components/views/elements/EditableItemList.js index c6eeb1b93c..ab0fe6e96a 100644 --- a/src/components/views/elements/EditableItemList.js +++ b/src/components/views/elements/EditableItemList.js @@ -121,8 +121,8 @@ export default class EditableItemList extends React.Component { return (