about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-12-30 13:53:39 +0100
committerThibG <thib@sitedethib.com>2018-12-30 14:07:57 +0100
commitd126240129681c64063f7f339eba55c105a94082 (patch)
tree6253a197329585e052736b762f99dab012067ed8
parent115b1abb6e30517fa56efc78551f5953b6ccef27 (diff)
Immediately go back in browser history upon successfully sending toot
-rw-r--r--app/javascript/flavours/glitch/actions/compose.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js
index d53d26924..71d3fb1b2 100644
--- a/app/javascript/flavours/glitch/actions/compose.js
+++ b/app/javascript/flavours/glitch/actions/compose.js
@@ -142,6 +142,12 @@ export function submitCompose(routerHistory) {
         'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']),
       },
     }).then(function (response) {
+      if (routerHistory && routerHistory.location.pathname === '/statuses/new'
+          && window.history.state
+          && !getState().getIn(['compose', 'advanced_options', 'threaded_mode'])) {
+        routerHistory.goBack();
+      }
+
       dispatch(insertIntoTagHistory(response.data.tags, status));
       dispatch(submitComposeSuccess({ ...response.data }));
 
@@ -158,12 +164,6 @@ export function submitCompose(routerHistory) {
         }
       };
 
-      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') {