From 34b427d15e106eb46a459ff0a1fe8722e8a57701 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 19 Feb 2018 23:41:07 +0000 Subject: [PATCH] s/quote_event/reply_to_event/ Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../views/rooms/MessageComposerInput.js | 11 ++--------- src/components/views/rooms/ReplyPreview.js | 2 +- src/stores/RoomViewStore.js | 16 +++++++++++----- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index c051471ba6..1de53b4cfc 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -275,7 +275,7 @@ export default class MessageComposerInput extends React.Component { let contentState = this.state.editorState.getCurrentContent(); switch (payload.action) { - case 'quote_event': + case 'reply_to_event': case 'focus_composer': editor.focus(); break; @@ -838,14 +838,7 @@ export default class MessageComposerInput extends React.Component { sendTextFn = ContentHelpers.makeEmoteMessage; } - const quotingEv = RoomViewStore.getQuotingEvent(); - const content = quotingEv ? Reply.getRelationship(quotingEv) : {}; - // we have finished quoting, clear the quotingEvent - // TODO maybe delay this until the event actually sends? - dis.dispatch({ - action: 'quote_event', - event: null, - }); + const content = Reply.getMRelatesTo(RoomViewStore.getQuotingEvent()); let sendMessagePromise; if (contentHTML) { diff --git a/src/components/views/rooms/ReplyPreview.js b/src/components/views/rooms/ReplyPreview.js index 18e21c5ebc..dd11b0df33 100644 --- a/src/components/views/rooms/ReplyPreview.js +++ b/src/components/views/rooms/ReplyPreview.js @@ -23,7 +23,7 @@ import SettingsStore from "../../../settings/SettingsStore"; function cancelQuoting() { dis.dispatch({ - action: 'quote_event', + action: 'reply_to_event', event: null, }); } diff --git a/src/stores/RoomViewStore.js b/src/stores/RoomViewStore.js index 4c010f4e8e..2c81f9de23 100644 --- a/src/stores/RoomViewStore.js +++ b/src/stores/RoomViewStore.js @@ -111,10 +111,16 @@ class RoomViewStore extends Store { forwardingEvent: payload.event, }); break; - case 'quote_event': + case 'reply_to_event': this._setState({ - quotingEvent: payload.event, + replyingToEvent: payload.event, }); + break; + case 'message_sent': + this._setState({ + replyingToEvent: null, + }); + break; } } @@ -132,8 +138,8 @@ class RoomViewStore extends Store { shouldPeek: payload.should_peek === undefined ? true : payload.should_peek, // have we sent a join request for this room and are waiting for a response? joining: payload.joining || false, - // Reset quotingEvent because we don't want cross-room because bad UX - quotingEvent: null, + // Reset replyingToEvent because we don't want cross-room because bad UX + replyingToEvent: null, }; if (this._state.forwardingEvent) { @@ -297,7 +303,7 @@ class RoomViewStore extends Store { // The mxEvent if one is currently being replied to/quoted getQuotingEvent() { - return this._state.quotingEvent; + return this._state.replyingToEvent; } shouldPeek() {