fix: allow editing free claims
This commit is contained in:
parent
31991a2ed1
commit
31e00c9353
1 changed files with 48 additions and 45 deletions
|
@ -34,7 +34,12 @@ export const doPrepareEdit = (claim: any) => (dispatch: Dispatch) => {
|
|||
const {
|
||||
author,
|
||||
description,
|
||||
fee,
|
||||
// use same values as default state
|
||||
// fee will be undefined for free content
|
||||
fee = {
|
||||
amount: 0,
|
||||
currency: 'LBC',
|
||||
},
|
||||
language,
|
||||
license,
|
||||
licenseUrl,
|
||||
|
@ -67,7 +72,7 @@ export const doPublish = (params: PublishParams): ThunkAction => {
|
|||
const {
|
||||
name,
|
||||
bid,
|
||||
filePath: file_path,
|
||||
filePath,
|
||||
description,
|
||||
language,
|
||||
license,
|
||||
|
@ -102,7 +107,7 @@ export const doPublish = (params: PublishParams): ThunkAction => {
|
|||
}
|
||||
|
||||
const publishPayload = {
|
||||
file_path,
|
||||
file_path: filePath,
|
||||
name,
|
||||
channel_name: channelName,
|
||||
bid,
|
||||
|
@ -130,52 +135,50 @@ export const doPublish = (params: PublishParams): ThunkAction => {
|
|||
};
|
||||
|
||||
// Calls claim_list_mine until any pending publishes are confirmed
|
||||
export const doCheckPendingPublishes = () => {
|
||||
return (dispatch: Dispatch, getState: GetState) => {
|
||||
const state = getState();
|
||||
const pendingPublishes = selectPendingPublishes(state);
|
||||
const myClaims = selectMyClaimsWithoutChannels(state);
|
||||
export const doCheckPendingPublishes = () => (dispatch: Dispatch, getState: GetState) => {
|
||||
const state = getState();
|
||||
const pendingPublishes = selectPendingPublishes(state);
|
||||
const myClaims = selectMyClaimsWithoutChannels(state);
|
||||
|
||||
let publishCheckInterval;
|
||||
let publishCheckInterval;
|
||||
|
||||
const checkFileList = () => {
|
||||
Lbry.claim_list_mine().then(claims => {
|
||||
const claimsWithoutChannels = claims.filter(claim => !claim.name.match(/^@/));
|
||||
if (myClaims.length !== claimsWithoutChannels.length) {
|
||||
const pendingPublishMap = {};
|
||||
pendingPublishes.forEach(({ name }) => {
|
||||
pendingPublishMap[name] = name;
|
||||
});
|
||||
const checkFileList = () => {
|
||||
Lbry.claim_list_mine().then(claims => {
|
||||
const claimsWithoutChannels = claims.filter(claim => !claim.name.match(/^@/));
|
||||
if (myClaims.length !== claimsWithoutChannels.length) {
|
||||
const pendingPublishMap = {};
|
||||
pendingPublishes.forEach(({ name }) => {
|
||||
pendingPublishMap[name] = name;
|
||||
});
|
||||
|
||||
claims.forEach(claim => {
|
||||
if (pendingPublishMap[claim.name]) {
|
||||
dispatch({
|
||||
type: ACTIONS.REMOVE_PENDING_PUBLISH,
|
||||
data: {
|
||||
name: claim.name,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED,
|
||||
data: {
|
||||
claims,
|
||||
},
|
||||
});
|
||||
claims.forEach(claim => {
|
||||
if (pendingPublishMap[claim.name]) {
|
||||
dispatch({
|
||||
type: ACTIONS.REMOVE_PENDING_PUBLISH,
|
||||
data: {
|
||||
name: claim.name,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED,
|
||||
data: {
|
||||
claims,
|
||||
},
|
||||
});
|
||||
|
||||
delete pendingPublishMap[claim.name];
|
||||
}
|
||||
});
|
||||
delete pendingPublishMap[claim.name];
|
||||
}
|
||||
});
|
||||
|
||||
clearInterval(publishCheckInterval);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (pendingPublishes.length) {
|
||||
checkFileList();
|
||||
publishCheckInterval = setInterval(() => {
|
||||
checkFileList();
|
||||
}, 10000);
|
||||
}
|
||||
clearInterval(publishCheckInterval);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (pendingPublishes.length) {
|
||||
checkFileList();
|
||||
publishCheckInterval = setInterval(() => {
|
||||
checkFileList();
|
||||
}, 10000);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue