From 22302991c8ad692dbd9dc5edfcef76dcdf2ecc92 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Fri, 10 May 2019 10:50:33 -0400 Subject: [PATCH] fix flow errors --- .eslintrc.json | 1 + flow-typed/publish.js | 4 +--- package.json | 2 +- src/ui/modal/modalRemoveFile/view.jsx | 3 +-- src/ui/redux/actions/publish.js | 21 +++++++++------------ 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 90984b76b..ca6035fa1 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -24,6 +24,7 @@ "rules": { "comma-dangle": ["error", "always-multiline"], "handle-callback-err": 0, + "indent": 0, "jsx-quotes": ["error", "prefer-double"], "new-cap": 0, "no-multi-spaces": 0, diff --git a/flow-typed/publish.js b/flow-typed/publish.js index 76266288b..27f626c6d 100644 --- a/flow-typed/publish.js +++ b/flow-typed/publish.js @@ -4,7 +4,7 @@ declare type UpdatePublishFormData = { filePath?: string, contentIsFree?: boolean, fee?: { - amount: string, + amount: number, currency: string, }, title?: string, @@ -46,8 +46,6 @@ declare type PublishParams = { amount: string, currency: string, }, - feeCurrency: string, - feeAmount: string, claim: StreamClaim, nsfw: boolean, }; diff --git a/package.json b/package.json index 4f21abd68..af107dd5b 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "jsmediatags": "^3.8.1", "json-loader": "^0.5.4", "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", "lint-staged": "^7.0.2", "localforage": "^1.7.1", diff --git a/src/ui/modal/modalRemoveFile/view.jsx b/src/ui/modal/modalRemoveFile/view.jsx index e480b417d..368683d1a 100644 --- a/src/ui/modal/modalRemoveFile/view.jsx +++ b/src/ui/modal/modalRemoveFile/view.jsx @@ -48,10 +48,9 @@ class ModalRemoveFile extends React.PureComponent { render() { const { claim, claimIsMine, closeModal, deleteFile, fileInfo, title } = this.props; const { deleteChecked, abandonClaimChecked } = this.state; - const { txid, nout } = claim; - const outpoint = fileInfo ? fileInfo.outpoint : `${txid}:${nout}`; + return ( (dispatch: Dis uri, uploadThumbnailStatus: thumbnail ? THUMBNAIL_STATUSES.MANUAL : undefined, licenseUrl, + nsfw: isClaimNsfw(claim), }; - if (claim && isClaimNsfw(claim)) { - publishData.nsfw = true; - } else { - publishData.nsfw = false; - } - // 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 (!CC_LICENSES.some(({ value }) => value === license)) { @@ -221,11 +216,13 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat channel_id?: string, bid: number, file_path?: string, - tags?: Array, + tags: Array, locations?: Array, license_url?: string, thumbnail_url?: string, release_time?: number, + fee_currency?: string, + fee_amount?: string, } = { name, bid: creditsToString(bid), @@ -250,7 +247,7 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat } 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) { @@ -258,9 +255,9 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat publishPayload.tags.push('mature'); } } else { - const remove = publishPayload.tags.indexOf('mature'); - if (remove > -1) { - publishPayload.tags.splice(remove, 1); + const indexToRemove = publishPayload.tags.indexOf('mature'); + if (indexToRemove > -1) { + publishPayload.tags.splice(indexToRemove, 1); } } @@ -268,7 +265,7 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat 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_amount = creditsToString(fee.amount); }