Immediately go back in browser history upon successfully sending toot

main
Thibaut Girka 2018-12-30 13:53:39 +01:00 committed by ThibG
parent 115b1abb6e
commit d126240129
1 changed files with 6 additions and 6 deletions

View File

@ -142,6 +142,12 @@ export function submitCompose(routerHistory) {
'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']), 'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']),
}, },
}).then(function (response) { }).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(insertIntoTagHistory(response.data.tags, status));
dispatch(submitComposeSuccess({ ...response.data })); 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'); insertIfOnline('home');
if (response.data.in_reply_to_id === null && response.data.visibility === 'public') { if (response.data.in_reply_to_id === null && response.data.visibility === 'public') {