fix flow errors

This commit is contained in:
Sean Yesmunt 2019-05-10 10:50:33 -04:00
parent 4f9f62f999
commit 22302991c8
5 changed files with 13 additions and 18 deletions

View file

@ -24,6 +24,7 @@
"rules": { "rules": {
"comma-dangle": ["error", "always-multiline"], "comma-dangle": ["error", "always-multiline"],
"handle-callback-err": 0, "handle-callback-err": 0,
"indent": 0,
"jsx-quotes": ["error", "prefer-double"], "jsx-quotes": ["error", "prefer-double"],
"new-cap": 0, "new-cap": 0,
"no-multi-spaces": 0, "no-multi-spaces": 0,

View file

@ -4,7 +4,7 @@ declare type UpdatePublishFormData = {
filePath?: string, filePath?: string,
contentIsFree?: boolean, contentIsFree?: boolean,
fee?: { fee?: {
amount: string, amount: number,
currency: string, currency: string,
}, },
title?: string, title?: string,
@ -46,8 +46,6 @@ declare type PublishParams = {
amount: string, amount: string,
currency: string, currency: string,
}, },
feeCurrency: string,
feeAmount: string,
claim: StreamClaim, claim: StreamClaim,
nsfw: boolean, nsfw: boolean,
}; };

View file

@ -117,7 +117,7 @@
"jsmediatags": "^3.8.1", "jsmediatags": "^3.8.1",
"json-loader": "^0.5.4", "json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git", "lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#423123f1c19e61cead67c745d0892a2e4481cb6a", "lbry-redux": "lbryio/lbry-redux#c8126ab21792d7a85e1123a2363af285a0263654",
"lbryinc": "lbryio/lbryinc#43d382d9b74d396a581a74d87e4c53105e04f845", "lbryinc": "lbryio/lbryinc#43d382d9b74d396a581a74d87e4c53105e04f845",
"lint-staged": "^7.0.2", "lint-staged": "^7.0.2",
"localforage": "^1.7.1", "localforage": "^1.7.1",

View file

@ -48,10 +48,9 @@ class ModalRemoveFile extends React.PureComponent<Props, State> {
render() { render() {
const { claim, claimIsMine, closeModal, deleteFile, fileInfo, title } = this.props; const { claim, claimIsMine, closeModal, deleteFile, fileInfo, title } = this.props;
const { deleteChecked, abandonClaimChecked } = this.state; const { deleteChecked, abandonClaimChecked } = this.state;
const { txid, nout } = claim; const { txid, nout } = claim;
const outpoint = fileInfo ? fileInfo.outpoint : `${txid}:${nout}`; const outpoint = fileInfo ? fileInfo.outpoint : `${txid}:${nout}`;
return ( return (
<Modal <Modal
isOpen isOpen

View file

@ -160,14 +160,9 @@ export const doPrepareEdit = (claim: StreamClaim, uri: string) => (dispatch: Dis
uri, uri,
uploadThumbnailStatus: thumbnail ? THUMBNAIL_STATUSES.MANUAL : undefined, uploadThumbnailStatus: thumbnail ? THUMBNAIL_STATUSES.MANUAL : undefined,
licenseUrl, licenseUrl,
nsfw: isClaimNsfw(claim),
}; };
if (claim && isClaimNsfw(claim)) {
publishData.nsfw = true;
} else {
publishData.nsfw = false;
}
// Make sure custom liscence's are mapped properly // Make sure custom liscence's are mapped properly
// If the license isn't one of the standard licenses, map the custom license and description/url // If the license isn't one of the standard licenses, map the custom license and description/url
if (!CC_LICENSES.some(({ value }) => value === license)) { if (!CC_LICENSES.some(({ value }) => value === license)) {
@ -221,11 +216,13 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
channel_id?: string, channel_id?: string,
bid: number, bid: number,
file_path?: string, file_path?: string,
tags?: Array<string>, tags: Array<string>,
locations?: Array<Location>, locations?: Array<Location>,
license_url?: string, license_url?: string,
thumbnail_url?: string, thumbnail_url?: string,
release_time?: number, release_time?: number,
fee_currency?: string,
fee_amount?: string,
} = { } = {
name, name,
bid: creditsToString(bid), bid: creditsToString(bid),
@ -250,7 +247,7 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
} }
if (claim && claim.value.release_time) { if (claim && claim.value.release_time) {
publishPayload.release_time = claim && Number(claim.value.release_time); publishPayload.release_time = Number(claim.value.release_time);
} }
if (nsfw) { if (nsfw) {
@ -258,9 +255,9 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
publishPayload.tags.push('mature'); publishPayload.tags.push('mature');
} }
} else { } else {
const remove = publishPayload.tags.indexOf('mature'); const indexToRemove = publishPayload.tags.indexOf('mature');
if (remove > -1) { if (indexToRemove > -1) {
publishPayload.tags.splice(remove, 1); publishPayload.tags.splice(indexToRemove, 1);
} }
} }
@ -268,7 +265,7 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
publishPayload.channel_id = channelId; publishPayload.channel_id = channelId;
} }
if (!contentIsFree && (fee.currency && Number(fee.amount) > 0)) { if (!contentIsFree && fee && (fee.currency && Number(fee.amount) > 0)) {
publishPayload.fee_currency = fee.currency; publishPayload.fee_currency = fee.currency;
publishPayload.fee_amount = creditsToString(fee.amount); publishPayload.fee_amount = creditsToString(fee.amount);
} }