mirror of
https://github.com/vector-im/element-web.git
synced 2025-12-17 07:11:10 +01:00
Merge pull request #3103 from matrix-org/t3chguy/edit_skip_if_no_edit
If oldContent matches newContent, skip sending the edit
This commit is contained in:
commit
000f7e8007
@ -187,6 +187,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 (!this._hasModifications ||
|
||||||
|
(oldContent["msgtype"] === newContent["msgtype"] && oldContent["body"] === newContent["body"] &&
|
||||||
|
oldContent["format"] === newContent["format"] &&
|
||||||
|
oldContent["formatted_body"] === newContent["formatted_body"])) {
|
||||||
|
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…
x
Reference in New Issue
Block a user