about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/actions/compose.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-05-16 20:17:08 +0200
committerGitHub <noreply@github.com>2018-05-16 20:17:08 +0200
commit80aad16e1035a72fec1af56aaac458a35e1f02c5 (patch)
tree3553dbe64377e08ca4ed2a2db62a487472bf8405 /app/javascript/flavours/glitch/actions/compose.js
parent9712d59dda848a7bc7fd9edb814c16717aa9ba6d (diff)
parent784712791da8c7d21afa62a3bf6a8fdac8c27a80 (diff)
Merge pull request #405 from ThibG/glitch-soc/features/dm-from-menu
[Glitch] Feature: Direct message from menu
Diffstat (limited to 'app/javascript/flavours/glitch/actions/compose.js')
-rw-r--r--app/javascript/flavours/glitch/actions/compose.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js
index 8a6ca3699..39381faa8 100644
--- a/app/javascript/flavours/glitch/actions/compose.js
+++ b/app/javascript/flavours/glitch/actions/compose.js
@@ -21,6 +21,7 @@ export const COMPOSE_SUBMIT_SUCCESS  = 'COMPOSE_SUBMIT_SUCCESS';
 export const COMPOSE_SUBMIT_FAIL     = 'COMPOSE_SUBMIT_FAIL';
 export const COMPOSE_REPLY           = 'COMPOSE_REPLY';
 export const COMPOSE_REPLY_CANCEL    = 'COMPOSE_REPLY_CANCEL';
+export const COMPOSE_DIRECT          = 'COMPOSE_DIRECT';
 export const COMPOSE_MENTION         = 'COMPOSE_MENTION';
 export const COMPOSE_RESET           = 'COMPOSE_RESET';
 export const COMPOSE_UPLOAD_REQUEST  = 'COMPOSE_UPLOAD_REQUEST';
@@ -102,6 +103,19 @@ export function mentionCompose(account, router) {
   };
 };
 
+export function directCompose(account, router) {
+  return (dispatch, getState) => {
+    dispatch({
+      type: COMPOSE_DIRECT,
+      account: account,
+    });
+
+    if (!getState().getIn(['compose', 'mounted'])) {
+      router.push('/statuses/new');
+    }
+  };
+};
+
 export function submitCompose() {
   return function (dispatch, getState) {
     let status = getState().getIn(['compose', 'text'], '');