General fixes from routing/lbry.tv changes #2437

Merged
neb-b merged 12 commits from fixes into master 2019-04-24 16:01:18 +02:00
2 changed files with 7 additions and 3 deletions
Showing only changes of commit 62a6b73942 - Show all commits

View file

@ -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));
},
});

View file

@ -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());
}
};
}