diff --git a/src/ui/modal/modalRemoveFile/index.js b/src/ui/modal/modalRemoveFile/index.js index 9b44ce8d0..59d0cdb70 100644 --- a/src/ui/modal/modalRemoveFile/index.js +++ b/src/ui/modal/modalRemoveFile/index.js @@ -1,5 +1,5 @@ import { connect } from 'react-redux'; -import { doDeleteFileAndGoBack } from 'redux/actions/file'; +import { doDeleteFileAndMaybeGoBack } from 'redux/actions/file'; import { makeSelectTitleForUri, makeSelectClaimIsMine, makeSelectFileInfoForUri } from 'lbry-redux'; import { doHideModal } from 'redux/actions/app'; import ModalRemoveFile from './view'; @@ -13,7 +13,7 @@ const select = (state, props) => ({ const perform = dispatch => ({ closeModal: () => dispatch(doHideModal()), deleteFile: (fileInfo, deleteFromComputer, abandonClaim) => { - dispatch(doDeleteFileAndGoBack(fileInfo, deleteFromComputer, abandonClaim)); + dispatch(doDeleteFileAndMaybeGoBack(fileInfo, deleteFromComputer, abandonClaim)); }, }); diff --git a/src/ui/redux/actions/file.js b/src/ui/redux/actions/file.js index fee8cb114..4fba2425d 100644 --- a/src/ui/redux/actions/file.js +++ b/src/ui/redux/actions/file.js @@ -10,6 +10,7 @@ import { selectFileInfosByOutpoint, } from 'lbry-redux'; import { doHideModal } from 'redux/actions/app'; +import { goBack } from 'connected-react-router'; export function doOpenFileInFolder(path) { return () => { @@ -58,11 +59,14 @@ export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim) { }; } -export function doDeleteFileAndGoBack(fileInfo, deleteFromComputer, abandonClaim) { +export function doDeleteFileAndMaybeGoBack(fileInfo, deleteFromComputer, abandonClaim) { return dispatch => { const actions = []; actions.push(doHideModal()); actions.push(doDeleteFile(fileInfo, deleteFromComputer, abandonClaim)); dispatch(batchActions(...actions)); + if (abandonClaim) { + dispatch(goBack()); + } }; }