bring in desktop publish changes

This commit is contained in:
Sean Yesmunt 2019-07-29 14:42:28 -04:00
parent 99f2e8e92f
commit 09ed2b5d18
4 changed files with 24 additions and 86 deletions

19
dist/bundle.es.js vendored
View file

@ -3009,10 +3009,10 @@ const doPrepareEdit = (claim, uri, fileInfo) => dispatch => {
const publishData = { const publishData = {
name, name,
bid: amount, bid: amount,
contentIsFree: !fee.amount, contentIsFree: fee.amount === '0',
author, author,
description, description,
fee: { amount: fee.amount, currency: fee.currency }, fee,
languages, languages,
thumbnail: thumbnail ? thumbnail.url : null, thumbnail: thumbnail ? thumbnail.url : null,
title, title,
@ -3080,7 +3080,6 @@ const doPublish = (success, fail) => (dispatch, getState) => {
contentIsFree, contentIsFree,
fee, fee,
uri, uri,
nsfw,
tags, tags,
locations locations
} = publishData; } = publishData;
@ -3125,19 +3124,13 @@ const doPublish = (success, fail) => (dispatch, getState) => {
publishPayload.thumbnail_url = thumbnail; publishPayload.thumbnail_url = thumbnail;
} }
// Set release time to curret date. On edits, keep original release/transaction time as release_time
if (myClaimForUri && myClaimForUri.value.release_time) { if (myClaimForUri && myClaimForUri.value.release_time) {
publishPayload.release_time = Number(myClaimForUri.value.release_time); publishPayload.release_time = Number(myClaimForUri.value.release_time);
} } else if (myClaimForUri && myClaimForUri.timestamp) {
publishPayload.release_time = Number(myClaimForUri.timestamp);
if (nsfw) {
if (!publishPayload.tags.includes('mature')) {
publishPayload.tags.push('mature');
}
} else { } else {
const indexToRemove = publishPayload.tags.indexOf('mature'); publishPayload.release_time = Number(Math.round(Date.now() / 1000));
if (indexToRemove > -1) {
publishPayload.tags.splice(indexToRemove, 1);
}
} }
if (channelId) { if (channelId) {

View file

@ -25,27 +25,3 @@ declare type UpdatePublishFormData = {
uri?: string, uri?: string,
nsfw: boolean, nsfw: boolean,
}; };
// This was only used when we were passing params instead of selecting them
declare type PublishParams = {
name: ?string,
bid: ?number,
filePath?: string,
description: ?string,
language: string,
publishingLicense?: string,
publishingLicenseUrl?: string,
thumbnail: ?string,
channel: string,
channelId?: string,
title: string,
contentIsFree: boolean,
uri?: string,
license: ?string,
licenseUrl: ?string,
fee?: {
amount: string,
currency: string,
},
claim: StreamClaim,
nsfw: boolean,
};

24
flow-typed/Publish.js vendored
View file

@ -25,27 +25,3 @@ declare type UpdatePublishFormData = {
uri?: string, uri?: string,
nsfw: boolean, nsfw: boolean,
}; };
// This was only used when we were passing params instead of selecting them
declare type PublishParams = {
name: ?string,
bid: ?number,
filePath?: string,
description: ?string,
language: string,
publishingLicense?: string,
publishingLicenseUrl?: string,
thumbnail: ?string,
channel: string,
channelId?: string,
title: string,
contentIsFree: boolean,
uri?: string,
license: ?string,
licenseUrl: ?string,
fee?: {
amount: string,
currency: string,
},
claim: StreamClaim,
nsfw: boolean,
};

View file

@ -118,12 +118,12 @@ export const doUploadThumbnail = (
.then(json => .then(json =>
json.success 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.url}${fileExt}`, thumbnail: `${json.data.url}${fileExt}`,
}, },
}) })
: uploadError(json.message) : uploadError(json.message)
) )
.catch(err => uploadError(err.message)); .catch(err => uploadError(err.message));
@ -157,12 +157,12 @@ export const doUploadThumbnail = (
.then(json => .then(json =>
json.success 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.url}${fileExt}`, thumbnail: `${json.data.url}${fileExt}`,
}, },
}) })
: uploadError(json.message) : uploadError(json.message)
) )
.catch(err => uploadError(err.message)); .catch(err => uploadError(err.message));
@ -194,10 +194,10 @@ export const doPrepareEdit = (claim: StreamClaim, uri: string, fileInfo: FileLis
const publishData: UpdatePublishFormData = { const publishData: UpdatePublishFormData = {
name, name,
bid: amount, bid: amount,
contentIsFree: !fee.amount, contentIsFree: fee.amount === '0',
author, author,
description, description,
fee: { amount: fee.amount, currency: fee.currency }, fee,
languages, languages,
thumbnail: thumbnail ? thumbnail.url : null, thumbnail: thumbnail ? thumbnail.url : null,
title, title,
@ -268,7 +268,6 @@ export const doPublish = (success: Function, fail: Function) => (
contentIsFree, contentIsFree,
fee, fee,
uri, uri,
nsfw,
tags, tags,
locations, locations,
} = publishData; } = publishData;
@ -329,19 +328,13 @@ export const doPublish = (success: Function, fail: Function) => (
publishPayload.thumbnail_url = thumbnail; publishPayload.thumbnail_url = thumbnail;
} }
// Set release time to curret date. On edits, keep original release/transaction time as release_time
if (myClaimForUri && myClaimForUri.value.release_time) { if (myClaimForUri && myClaimForUri.value.release_time) {
publishPayload.release_time = Number(myClaimForUri.value.release_time); publishPayload.release_time = Number(myClaimForUri.value.release_time);
} } else if (myClaimForUri && myClaimForUri.timestamp) {
publishPayload.release_time = Number(myClaimForUri.timestamp);
if (nsfw) {
if (!publishPayload.tags.includes('mature')) {
publishPayload.tags.push('mature');
}
} else { } else {
const indexToRemove = publishPayload.tags.indexOf('mature'); publishPayload.release_time = Number(Math.round(Date.now() / 1000));
if (indexToRemove > -1) {
publishPayload.tags.splice(indexToRemove, 1);
}
} }
if (channelId) { if (channelId) {