diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-11-21 10:52:11 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-11-21 10:52:11 +0100 |
commit | d32e0364f9aa2d61080c53489996351d4bd7b1c4 (patch) | |
tree | b30efea75acedb9a7fdf54727c2a54066f976c6d /app/assets/javascripts/components/actions | |
parent | 93577f74e7ec2edee3a1a208513ae7290211e682 (diff) |
Switch to compose route when replying and compose is not mounted
Diffstat (limited to 'app/assets/javascripts/components/actions')
-rw-r--r-- | app/assets/javascripts/components/actions/compose.jsx | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/app/assets/javascripts/components/actions/compose.jsx b/app/assets/javascripts/components/actions/compose.jsx index b77a9c727..af3cdbf30 100644 --- a/app/assets/javascripts/components/actions/compose.jsx +++ b/app/assets/javascripts/components/actions/compose.jsx @@ -19,6 +19,9 @@ export const COMPOSE_SUGGESTIONS_CLEAR = 'COMPOSE_SUGGESTIONS_CLEAR'; export const COMPOSE_SUGGESTIONS_READY = 'COMPOSE_SUGGESTIONS_READY'; export const COMPOSE_SUGGESTION_SELECT = 'COMPOSE_SUGGESTION_SELECT'; +export const COMPOSE_MOUNT = 'COMPOSE_MOUNT'; +export const COMPOSE_UNMOUNT = 'COMPOSE_UNMOUNT'; + export function changeCompose(text) { return { type: COMPOSE_CHANGE, @@ -26,10 +29,16 @@ export function changeCompose(text) { }; }; -export function replyCompose(status) { - return { - type: COMPOSE_REPLY, - status: status +export function replyCompose(status, router) { + return (dispatch, getState) => { + dispatch({ + type: COMPOSE_REPLY, + status: status + }); + + if (!getState().getIn(['compose', 'mounted'])) { + router.push('/statuses/new'); + } }; }; @@ -176,3 +185,15 @@ export function selectComposeSuggestion(position, accountId) { }); }; }; + +export function mountCompose() { + return { + type: COMPOSE_MOUNT + }; +}; + +export function unmountCompose() { + return { + type: COMPOSE_UNMOUNT + }; +}; |