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] 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": {