mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-04 22:00:42 +03:00
If oldContent matches newContent, skip sending the edit
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
2a7301fa8f
commit
41b995df3c
1 changed files with 11 additions and 0 deletions
|
@ -166,6 +166,17 @@ export default class MessageEditor extends React.Component {
|
||||||
contentBody.format = newContent.format;
|
contentBody.format = newContent.format;
|
||||||
contentBody.formatted_body = ` * ${newContent.formatted_body}`;
|
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({
|
const content = Object.assign({
|
||||||
"m.new_content": newContent,
|
"m.new_content": newContent,
|
||||||
"m.relates_to": {
|
"m.relates_to": {
|
||||||
|
|
Loading…
Reference in a new issue