about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/actions/compose.js
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-12-13 16:50:37 +0100
committerThibG <thib@sitedethib.com>2018-12-14 23:56:53 +0100
commitf0505a5b2e727da73c8aa651b804508a8187a3c4 (patch)
treea0380bec75672247513d4383e2932231bfd50283 /app/javascript/flavours/glitch/actions/compose.js
parent35b2ba5030dd7fb5ddbb8cb34d0fd54cec8cf269 (diff)
On mobile, go back in browser history upon posting, unless threaded mode is enabled
Diffstat (limited to 'app/javascript/flavours/glitch/actions/compose.js')
-rw-r--r--app/javascript/flavours/glitch/actions/compose.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js
index 58f2b3786..d53d26924 100644
--- a/app/javascript/flavours/glitch/actions/compose.js
+++ b/app/javascript/flavours/glitch/actions/compose.js
@@ -116,7 +116,7 @@ export function directCompose(account, router) {
   };
 };
 
-export function submitCompose() {
+export function submitCompose(routerHistory) {
   return function (dispatch, getState) {
     let status = getState().getIn(['compose', 'text'], '');
     let media  = getState().getIn(['compose', 'media_attachments']);
@@ -158,6 +158,12 @@ export function submitCompose() {
         }
       };
 
+      if (routerHistory && routerHistory.location.pathname === '/statuses/new'
+          && window.history.state
+          && !getState().getIn(['compose', 'advanced_options', 'threaded_mode'])) {
+        routerHistory.goBack();
+      }
+
       insertIfOnline('home');
 
       if (response.data.in_reply_to_id === null && response.data.visibility === 'public') {