Change how release_time is edited. #412

Merged
infinite-persistence merged 2 commits from ip/release-time into master 2021-05-14 23:30:25 +02:00
3 changed files with 21 additions and 16 deletions

10
dist/bundle.es.js vendored
View file

@ -4786,7 +4786,8 @@ const doPrepareEdit = (claim, uri, fileInfo, fs) => dispatch => {
description, description,
fee, fee,
languages, languages,
release_time: release_time ? Number(release_time) * 1000 : undefined, releaseTime: release_time,
releaseTimeEdited: undefined,
thumbnail: thumbnail ? thumbnail.url : null, thumbnail: thumbnail ? thumbnail.url : null,
title, title,
uri, uri,
@ -4837,7 +4838,7 @@ const doPublish = (success, fail, preview) => (dispatch, getState) => {
filePath, filePath,
description, description,
language, language,
releaseTime, releaseTimeEdited,
license, license,
licenseUrl, licenseUrl,
useLBRYUploader, useLBRYUploader,
@ -4909,8 +4910,8 @@ const doPublish = (success, fail, preview) => (dispatch, getState) => {
} }
// Set release time to curret date. On edits, keep original release/transaction time as release_time // Set release time to curret date. On edits, keep original release/transaction time as release_time
if (releaseTime) { if (releaseTimeEdited) {
publishPayload.release_time = Number(Math.round(new Date(releaseTime) / 1000)); publishPayload.release_time = releaseTimeEdited;
} else if (myClaimForUriEditing && myClaimForUriEditing.value.release_time) { } else if (myClaimForUriEditing && myClaimForUriEditing.value.release_time) {
publishPayload.release_time = Number(myClaimForUri.value.release_time); publishPayload.release_time = Number(myClaimForUri.value.release_time);
} else if (myClaimForUriEditing && myClaimForUriEditing.timestamp) { } else if (myClaimForUriEditing && myClaimForUriEditing.timestamp) {
@ -6060,6 +6061,7 @@ const defaultState$4 = {
description: '', description: '',
language: '', language: '',
releaseTime: undefined, releaseTime: undefined,
releaseTimeEdited: undefined,
nsfw: false, nsfw: false,
channel: CHANNEL_ANONYMOUS, channel: CHANNEL_ANONYMOUS,
channelId: '', channelId: '',

View file

@ -106,12 +106,12 @@ export const doUploadThumbnail = (
.then(json => { .then(json => {
return json.success return json.success
? dispatch({ ? dispatch({
type: ACTIONS.UPDATE_PUBLISH_FORM, type: ACTIONS.UPDATE_PUBLISH_FORM,
data: { data: {
uploadThumbnailStatus: THUMBNAIL_STATUSES.COMPLETE, uploadThumbnailStatus: THUMBNAIL_STATUSES.COMPLETE,
thumbnail: json.data.serveUrl, thumbnail: json.data.serveUrl,
}, },
}) })
: uploadError(json.message || downMessage); : uploadError(json.message || downMessage);
}) })
.catch(err => { .catch(err => {
@ -200,7 +200,8 @@ export const doPrepareEdit = (claim: StreamClaim, uri: string, fileInfo: FileLis
description, description,
fee, fee,
languages, languages,
release_time: release_time ? Number(release_time) * 1000 : undefined, releaseTime: release_time,
releaseTimeEdited: undefined,
thumbnail: thumbnail ? thumbnail.url : null, thumbnail: thumbnail ? thumbnail.url : null,
title, title,
uri, uri,
@ -254,7 +255,7 @@ export const doPublish = (success: Function, fail: Function, preview: Function)
filePath, filePath,
description, description,
language, language,
releaseTime, releaseTimeEdited,
license, license,
licenseUrl, licenseUrl,
useLBRYUploader, useLBRYUploader,
@ -347,8 +348,8 @@ 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 // Set release time to curret date. On edits, keep original release/transaction time as release_time
if (releaseTime) { if (releaseTimeEdited) {
publishPayload.release_time = Number(Math.round(new Date(releaseTime) / 1000)); publishPayload.release_time = releaseTimeEdited;
} else if (myClaimForUriEditing && myClaimForUriEditing.value.release_time) { } else if (myClaimForUriEditing && myClaimForUriEditing.value.release_time) {
publishPayload.release_time = Number(myClaimForUri.value.release_time); publishPayload.release_time = Number(myClaimForUri.value.release_time);
} else if (myClaimForUriEditing && myClaimForUriEditing.timestamp) { } else if (myClaimForUriEditing && myClaimForUriEditing.timestamp) {
@ -412,7 +413,7 @@ export const doCheckReflectingFiles = () => (dispatch: Dispatch, getState: GetSt
const { checkingReflector } = state.claims; const { checkingReflector } = state.claims;
let reflectorCheckInterval; let reflectorCheckInterval;
const checkFileList = async () => { const checkFileList = async() => {
const state = getState(); const state = getState();
const reflectingById = selectReflectingById(state); const reflectingById = selectReflectingById(state);
const ids = Object.keys(reflectingById); const ids = Object.keys(reflectingById);

View file

@ -25,7 +25,8 @@ type PublishState = {
thumbnailError: ?boolean, thumbnailError: ?boolean,
description: string, description: string,
language: string, language: string,
releaseTime: ?string, releaseTime: ?number,
releaseTimeEdited: ?number,
channel: string, channel: string,
channelId: ?string, channelId: ?string,
name: string, name: string,
@ -60,6 +61,7 @@ const defaultState: PublishState = {
description: '', description: '',
language: '', language: '',
releaseTime: undefined, releaseTime: undefined,
releaseTimeEdited: undefined,
nsfw: false, nsfw: false,
channel: CHANNEL_ANONYMOUS, channel: CHANNEL_ANONYMOUS,
channelId: '', channelId: '',