Search and file delete fixes
This commit is contained in:
parent
1f12943efe
commit
d17fecbdd4
4 changed files with 25 additions and 7 deletions
|
@ -257,7 +257,7 @@ lbry.file_list = function(params = {}) {
|
|||
* see https://github.com/lbryio/lbry-app/issues/693 for reference
|
||||
* rest all of the functionality remains the same and it is still based on outpoints
|
||||
*/
|
||||
const newParams = { sd_hash };
|
||||
const newParams = { sd_hash, full_status: params.full_status };
|
||||
/**
|
||||
* If we're searching by outpoint, check first to see if there's a matching pending publish.
|
||||
* Pending publishes use their own faux outpoints that are always unique, so we don't need
|
||||
|
|
|
@ -4,13 +4,14 @@ import { doFetchClaimListMine, doAbandonClaim, doResolveUri } from "redux/action
|
|||
import {
|
||||
selectClaimsByUri,
|
||||
selectIsFetchingClaimListMine,
|
||||
selectMyClaimSdHashesByOutpoint,
|
||||
selectMyClaimsOutpoints,
|
||||
} from "redux/selectors/claims";
|
||||
import {
|
||||
selectIsFetchingFileList,
|
||||
selectFileInfosBySdHash,
|
||||
selectFetchingSdHash,
|
||||
selectTotalDownloadProgress,
|
||||
selectSdHashesByOutpoint,
|
||||
} from "redux/selectors/file_info";
|
||||
import { doCloseModal } from "redux/actions/app";
|
||||
import { doNavigate, doHistoryBack } from "redux/actions/navigation";
|
||||
|
@ -89,6 +90,7 @@ export function doOpenFileInFolder(path) {
|
|||
export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim) {
|
||||
return function(dispatch, getState) {
|
||||
const state = getState();
|
||||
const sdHash = selectSdHashesByOutpoint(state)[outpoint];
|
||||
|
||||
lbry.file_delete({
|
||||
outpoint: outpoint,
|
||||
|
@ -98,9 +100,6 @@ export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim) {
|
|||
// If the file is for a claim we published then also abandom the claim
|
||||
const myClaimsOutpoints = selectMyClaimsOutpoints(state);
|
||||
if (abandonClaim && myClaimsOutpoints.indexOf(outpoint) !== -1) {
|
||||
// This is the only place which links sd_hashes to outpoints(of claims which are mine)
|
||||
const sdHashesByOutpoint = selectMyClaimSdHashesByOutpoint(state);
|
||||
const sdHash = sdHashesByOutpoint[outpoint];
|
||||
const bySdHash = selectFileInfosBySdHash(state);
|
||||
const fileInfo = bySdHash[sd_hash];
|
||||
|
||||
|
@ -115,7 +114,7 @@ export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim) {
|
|||
dispatch({
|
||||
type: types.FILE_DELETE,
|
||||
data: {
|
||||
sd_hash,
|
||||
sdHash,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -194,6 +194,8 @@ export const selectMyClaimSdHashesByOutpoint = createSelector(
|
|||
myClaims => {
|
||||
const sdHashByOutpoint = {};
|
||||
|
||||
console.log(myClaims);
|
||||
|
||||
myClaims.forEach(claim => {
|
||||
sdHashByOutpoint[`${claim.txid}:${claim.nout}`] =
|
||||
claim.value.stream.source.source;
|
||||
|
|
|
@ -32,7 +32,11 @@ export const makeSelectFileInfoForUri = uri => {
|
|||
selectFileInfosBySdHash,
|
||||
(claims, bySdHash) => {
|
||||
const claim = claims[uri];
|
||||
const sd_hash = claim ? claim.value.stream.source.source : undefined;
|
||||
let sd_hash = undefined;
|
||||
|
||||
if (claim && !claim.name.startsWith("@")) {
|
||||
sd_hash = claim ? claim.value.stream.source.source : undefined;
|
||||
}
|
||||
|
||||
return sd_hash ? bySdHash[sd_hash] : undefined;
|
||||
}
|
||||
|
@ -167,3 +171,16 @@ export const selectTotalDownloadProgress = createSelector(
|
|||
else return -1;
|
||||
}
|
||||
);
|
||||
|
||||
export const selectSdHashesByOutpoint = createSelector(
|
||||
selectFileInfosBySdHash,
|
||||
fileInfos => {
|
||||
const sdHashesByOutpoint = {};
|
||||
|
||||
Object.keys(fileInfos).forEach(fileInfo => {
|
||||
sdHashesByOutpoint[fileInfo.outpoint] = fileInfo.sd_hash;
|
||||
});
|
||||
|
||||
return sdHashesByOutpoint;
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue