]> cat aescling's git repositories - mastodon.git/commitdiff
Immediately go back in browser history upon successfully sending toot
authorThibaut Girka <thib@sitedethib.com>
Sun, 30 Dec 2018 12:53:39 +0000 (13:53 +0100)
committerThibG <thib@sitedethib.com>
Sun, 30 Dec 2018 13:07:57 +0000 (14:07 +0100)
app/javascript/flavours/glitch/actions/compose.js

index d53d269249c1897ec430eb4a5366a57ad5861f4c..71d3fb1b238944236ccc0c5f4b10ae4fe277f94a 100644 (file)
@@ -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') {