From 2ff98b7c1f99ef2b9ec09c878c1824b0791f9f83 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 10 Sep 2019 08:51:27 +0100 Subject: [PATCH] clear up ambiguity by poor naming Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/EditMessageComposer.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/EditMessageComposer.js b/src/components/views/rooms/EditMessageComposer.js index 58f1f75726..89aea64139 100644 --- a/src/components/views/rooms/EditMessageComposer.js +++ b/src/components/views/rooms/EditMessageComposer.js @@ -164,7 +164,7 @@ export default class EditMessageComposer extends React.Component { dis.dispatch({action: 'focus_composer'}); } - _isModifiedOrSameAsOld(newContent) { + _isContentModified(newContent) { // if nothing has changed then bail const oldContent = this.props.editState.getEvent().getContent(); if (!this._editorRef.isModified() || @@ -181,12 +181,14 @@ export default class EditMessageComposer extends React.Component { const editContent = createEditContent(this.model, editedEvent); const newContent = editContent["m.new_content"]; - if (this._isModifiedOrSameAsOld(newContent)) { + // If content is modified then send an updated event into the room + if (this._isContentModified(newContent)) { const roomId = editedEvent.getRoomId(); this._cancelPreviousPendingEdit(); this.context.matrixClient.sendMessage(roomId, editContent); } + // close the event editing and focus composer dis.dispatch({action: "edit_event", event: null}); dis.dispatch({action: 'focus_composer'}); };