diff --git a/app/javascript/gabsocial/actions/compose.js b/app/javascript/gabsocial/actions/compose.js
index 6923f205..0a4f6bd6 100644
--- a/app/javascript/gabsocial/actions/compose.js
+++ b/app/javascript/gabsocial/actions/compose.js
@@ -1,4 +1,5 @@
import api from '../api';
+import { FormattedMessage } from 'react-intl'
import { CancelToken, isCancel } from 'axios';
import throttle from 'lodash.throttle'
import moment from 'moment-mini'
@@ -13,6 +14,7 @@ import { updateTimeline, dequeueTimeline } from './timelines';
import { defineMessages } from 'react-intl';
import { openModal, closeModal } from './modal';
import { me } from '../initial_state';
+import { makeGetStatus } from '../selectors'
let cancelFetchComposeSuggestionsAccounts;
@@ -79,14 +81,88 @@ export const ensureComposeIsVisible = (getState, routerHistory) => {
};
export function changeCompose(text, markdown, replyId) {
- console.log("changeCompose:", text)
- return {
- type: COMPOSE_CHANGE,
- text: text,
- markdown: markdown,
- replyId: replyId,
- };
-};
+ return function (dispatch, getState) {
+ const reduxReplyToId = getState().getIn(['compose', 'in_reply_to'])
+ const existingText = getState().getIn(['compose', 'text']).trim()
+ const isModalOpen = getState().getIn(['modal', 'modalType']) === 'COMPOSE'
+
+ let status
+ if (!!replyId) {
+ status = getState().getIn(['statuses', replyId])
+ status = makeGetStatus()(getState(), {
+ id: status.get('id')
+ })
+ }
+
+ if (!!replyId && replyId !== reduxReplyToId && !isModalOpen) {
+ if (existingText.length === 0 && text.trim().length > 0) {
+ dispatch({
+ type: COMPOSE_REPLY,
+ status: status,
+ })
+ dispatch({
+ type: COMPOSE_CHANGE,
+ text: text,
+ markdown: markdown,
+ })
+ } else if (existingText.length > 0 && text.trim().length > 0) {
+ dispatch(openModal('CONFIRM', {
+ message: