s/quote_event/reply_to_event/

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2018-02-19 23:41:07 +00:00
parent 6510989ac6
commit 34b427d15e
No known key found for this signature in database
GPG Key ID: 3F879DA5AD802A5E
3 changed files with 14 additions and 15 deletions

View File

@ -275,7 +275,7 @@ export default class MessageComposerInput extends React.Component {
let contentState = this.state.editorState.getCurrentContent(); let contentState = this.state.editorState.getCurrentContent();
switch (payload.action) { switch (payload.action) {
case 'quote_event': case 'reply_to_event':
case 'focus_composer': case 'focus_composer':
editor.focus(); editor.focus();
break; break;
@ -838,14 +838,7 @@ export default class MessageComposerInput extends React.Component {
sendTextFn = ContentHelpers.makeEmoteMessage; sendTextFn = ContentHelpers.makeEmoteMessage;
} }
const quotingEv = RoomViewStore.getQuotingEvent(); const content = Reply.getMRelatesTo(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,
});
let sendMessagePromise; let sendMessagePromise;
if (contentHTML) { if (contentHTML) {

View File

@ -23,7 +23,7 @@ import SettingsStore from "../../../settings/SettingsStore";
function cancelQuoting() { function cancelQuoting() {
dis.dispatch({ dis.dispatch({
action: 'quote_event', action: 'reply_to_event',
event: null, event: null,
}); });
} }

View File

@ -111,10 +111,16 @@ class RoomViewStore extends Store {
forwardingEvent: payload.event, forwardingEvent: payload.event,
}); });
break; break;
case 'quote_event': case 'reply_to_event':
this._setState({ 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, shouldPeek: payload.should_peek === undefined ? true : payload.should_peek,
// have we sent a join request for this room and are waiting for a response? // have we sent a join request for this room and are waiting for a response?
joining: payload.joining || false, joining: payload.joining || false,
// Reset quotingEvent because we don't want cross-room because bad UX // Reset replyingToEvent because we don't want cross-room because bad UX
quotingEvent: null, replyingToEvent: null,
}; };
if (this._state.forwardingEvent) { if (this._state.forwardingEvent) {
@ -297,7 +303,7 @@ class RoomViewStore extends Store {
// The mxEvent if one is currently being replied to/quoted // The mxEvent if one is currently being replied to/quoted
getQuotingEvent() { getQuotingEvent() {
return this._state.quotingEvent; return this._state.replyingToEvent;
} }
shouldPeek() { shouldPeek() {