From 5ea369ee760d335ea0f2eeb297bc10c83db91ede Mon Sep 17 00:00:00 2001 From: Franco Montenegro Date: Thu, 11 Feb 2021 11:12:15 -0300 Subject: [PATCH] Add release time to publish --- dist/bundle.es.js | 20 +++++++++++++++++++- src/redux/actions/publish.js | 7 ++++++- src/redux/reducers/publish.js | 1 + 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index af5c7a8..f6c0b6e 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -1532,6 +1532,18 @@ function buildURI(UrlObj, includeProto = true, protoDefault = 'lbry://') { deprecatedParts = _objectWithoutProperties(UrlObj, ['streamName', 'streamClaimId', 'channelName', 'channelClaimId', 'primaryClaimSequence', 'primaryBidPosition', 'secondaryClaimSequence', 'secondaryBidPosition', 'startTime']); const { claimId, claimName, contentName } = deprecatedParts; + { + if (claimId) { + console.error(__("'claimId' should no longer be used. Use 'streamClaimId' or 'channelClaimId' instead")); + } + if (claimName) { + console.error(__("'claimName' should no longer be used. Use 'streamClaimName' or 'channelClaimName' instead")); + } + if (contentName) { + console.error(__("'contentName' should no longer be used. Use 'streamName' instead")); + } + } + if (!claimName && !channelName && !streamName) { console.error(__("'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url.")); } @@ -4625,6 +4637,7 @@ const doPrepareEdit = (claim, uri, fileInfo, fs) => dispatch => { currency: 'LBC' }, languages, + release_time, license, license_url: licenseUrl, thumbnail, @@ -4640,6 +4653,7 @@ const doPrepareEdit = (claim, uri, fileInfo, fs) => dispatch => { description, fee, languages, + release_time: release_time ? Number(release_time) * 1000 : undefined, thumbnail: thumbnail ? thumbnail.url : null, title, uri, @@ -4690,6 +4704,7 @@ const doPublish = (success, fail, preview) => (dispatch, getState) => { filePath, description, language, + release_time, license, licenseUrl, useLBRYUploader, @@ -4757,7 +4772,9 @@ const doPublish = (success, fail, preview) => (dispatch, getState) => { } // Set release time to curret date. On edits, keep original release/transaction time as release_time - if (myClaimForUriEditing && myClaimForUriEditing.value.release_time) { + if (release_time) { + publishPayload.release_time = Number(Math.round(new Date(release_time) / 1000)); + } else if (myClaimForUriEditing && myClaimForUriEditing.value.release_time) { publishPayload.release_time = Number(myClaimForUri.value.release_time); } else if (myClaimForUriEditing && myClaimForUriEditing.timestamp) { publishPayload.release_time = Number(myClaimForUriEditing.timestamp); @@ -5930,6 +5947,7 @@ const defaultState$4 = { uploadThumbnailStatus: API_DOWN, description: '', language: '', + release_time: undefined, nsfw: false, channel: CHANNEL_ANONYMOUS, channelId: '', diff --git a/src/redux/actions/publish.js b/src/redux/actions/publish.js index 50aca07..952395d 100644 --- a/src/redux/actions/publish.js +++ b/src/redux/actions/publish.js @@ -184,6 +184,7 @@ export const doPrepareEdit = (claim: StreamClaim, uri: string, fileInfo: FileLis currency: 'LBC', }, languages, + release_time, license, license_url: licenseUrl, thumbnail, @@ -199,6 +200,7 @@ export const doPrepareEdit = (claim: StreamClaim, uri: string, fileInfo: FileLis description, fee, languages, + release_time: release_time ? Number(release_time) * 1000 : undefined, thumbnail: thumbnail ? thumbnail.url : null, title, uri, @@ -252,6 +254,7 @@ export const doPublish = (success: Function, fail: Function, preview: Function) filePath, description, language, + release_time, license, licenseUrl, useLBRYUploader, @@ -339,7 +342,9 @@ export const doPublish = (success: Function, fail: Function, preview: Function) } // Set release time to curret date. On edits, keep original release/transaction time as release_time - if (myClaimForUriEditing && myClaimForUriEditing.value.release_time) { + if (release_time) { + publishPayload.release_time = Number(Math.round(new Date(release_time) / 1000)); + } else if (myClaimForUriEditing && myClaimForUriEditing.value.release_time) { publishPayload.release_time = Number(myClaimForUri.value.release_time); } else if (myClaimForUriEditing && myClaimForUriEditing.timestamp) { publishPayload.release_time = Number(myClaimForUriEditing.timestamp); diff --git a/src/redux/reducers/publish.js b/src/redux/reducers/publish.js index e33b57d..a75181d 100644 --- a/src/redux/reducers/publish.js +++ b/src/redux/reducers/publish.js @@ -54,6 +54,7 @@ const defaultState: PublishState = { uploadThumbnailStatus: THUMBNAIL_STATUSES.API_DOWN, description: '', language: '', + release_time: undefined, nsfw: false, channel: CHANNEL_ANONYMOUS, channelId: '',