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 {
|
const {
|
||||||
author,
|
author,
|
||||||
description,
|
description,
|
||||||
fee,
|
// use same values as default state
|
||||||
|
// fee will be undefined for free content
|
||||||
|
fee = {
|
||||||
|
amount: 0,
|
||||||
|
currency: 'LBC',
|
||||||
|
},
|
||||||
language,
|
language,
|
||||||
license,
|
license,
|
||||||
licenseUrl,
|
licenseUrl,
|
||||||
|
@ -67,7 +72,7 @@ export const doPublish = (params: PublishParams): ThunkAction => {
|
||||||
const {
|
const {
|
||||||
name,
|
name,
|
||||||
bid,
|
bid,
|
||||||
filePath: file_path,
|
filePath,
|
||||||
description,
|
description,
|
||||||
language,
|
language,
|
||||||
license,
|
license,
|
||||||
|
@ -102,7 +107,7 @@ export const doPublish = (params: PublishParams): ThunkAction => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const publishPayload = {
|
const publishPayload = {
|
||||||
file_path,
|
file_path: filePath,
|
||||||
name,
|
name,
|
||||||
channel_name: channelName,
|
channel_name: channelName,
|
||||||
bid,
|
bid,
|
||||||
|
@ -130,52 +135,50 @@ export const doPublish = (params: PublishParams): ThunkAction => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Calls claim_list_mine until any pending publishes are confirmed
|
// Calls claim_list_mine until any pending publishes are confirmed
|
||||||
export const doCheckPendingPublishes = () => {
|
export const doCheckPendingPublishes = () => (dispatch: Dispatch, getState: GetState) => {
|
||||||
return (dispatch: Dispatch, getState: GetState) => {
|
const state = getState();
|
||||||
const state = getState();
|
const pendingPublishes = selectPendingPublishes(state);
|
||||||
const pendingPublishes = selectPendingPublishes(state);
|
const myClaims = selectMyClaimsWithoutChannels(state);
|
||||||
const myClaims = selectMyClaimsWithoutChannels(state);
|
|
||||||
|
|
||||||
let publishCheckInterval;
|
let publishCheckInterval;
|
||||||
|
|
||||||
const checkFileList = () => {
|
const checkFileList = () => {
|
||||||
Lbry.claim_list_mine().then(claims => {
|
Lbry.claim_list_mine().then(claims => {
|
||||||
const claimsWithoutChannels = claims.filter(claim => !claim.name.match(/^@/));
|
const claimsWithoutChannels = claims.filter(claim => !claim.name.match(/^@/));
|
||||||
if (myClaims.length !== claimsWithoutChannels.length) {
|
if (myClaims.length !== claimsWithoutChannels.length) {
|
||||||
const pendingPublishMap = {};
|
const pendingPublishMap = {};
|
||||||
pendingPublishes.forEach(({ name }) => {
|
pendingPublishes.forEach(({ name }) => {
|
||||||
pendingPublishMap[name] = name;
|
pendingPublishMap[name] = name;
|
||||||
});
|
});
|
||||||
|
|
||||||
claims.forEach(claim => {
|
claims.forEach(claim => {
|
||||||
if (pendingPublishMap[claim.name]) {
|
if (pendingPublishMap[claim.name]) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.REMOVE_PENDING_PUBLISH,
|
type: ACTIONS.REMOVE_PENDING_PUBLISH,
|
||||||
data: {
|
data: {
|
||||||
name: claim.name,
|
name: claim.name,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED,
|
type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED,
|
||||||
data: {
|
data: {
|
||||||
claims,
|
claims,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
delete pendingPublishMap[claim.name];
|
delete pendingPublishMap[claim.name];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
clearInterval(publishCheckInterval);
|
clearInterval(publishCheckInterval);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
if (pendingPublishes.length) {
|
|
||||||
checkFileList();
|
|
||||||
publishCheckInterval = setInterval(() => {
|
|
||||||
checkFileList();
|
|
||||||
}, 10000);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (pendingPublishes.length) {
|
||||||
|
checkFileList();
|
||||||
|
publishCheckInterval = setInterval(() => {
|
||||||
|
checkFileList();
|
||||||
|
}, 10000);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue