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 = {
name,
bid: amount,
contentIsFree: !fee.amount,
contentIsFree: fee.amount === '0',
author,
description,
fee: { amount: fee.amount, currency: fee.currency },
fee,
languages,
thumbnail: thumbnail ? thumbnail.url : null,
title,
@ -3080,7 +3080,6 @@ const doPublish = (success, fail) => (dispatch, getState) => {
contentIsFree,
fee,
uri,
nsfw,
tags,
locations
} = publishData;
@ -3125,19 +3124,13 @@ const doPublish = (success, fail) => (dispatch, getState) => {
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) {
publishPayload.release_time = Number(myClaimForUri.value.release_time);
}
if (nsfw) {
if (!publishPayload.tags.includes('mature')) {
publishPayload.tags.push('mature');
}
} else if (myClaimForUri && myClaimForUri.timestamp) {
publishPayload.release_time = Number(myClaimForUri.timestamp);
} else {
const indexToRemove = publishPayload.tags.indexOf('mature');
if (indexToRemove > -1) {
publishPayload.tags.splice(indexToRemove, 1);
}
publishPayload.release_time = Number(Math.round(Date.now() / 1000));
}
if (channelId) {

View file

@ -25,27 +25,3 @@ declare type UpdatePublishFormData = {
uri?: string,
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,
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 =>
json.success
? dispatch({
type: ACTIONS.UPDATE_PUBLISH_FORM,
data: {
uploadThumbnailStatus: THUMBNAIL_STATUSES.COMPLETE,
thumbnail: `${json.data.url}${fileExt}`,
},
})
type: ACTIONS.UPDATE_PUBLISH_FORM,
data: {
uploadThumbnailStatus: THUMBNAIL_STATUSES.COMPLETE,
thumbnail: `${json.data.url}${fileExt}`,
},
})
: uploadError(json.message)
)
.catch(err => uploadError(err.message));
@ -157,12 +157,12 @@ export const doUploadThumbnail = (
.then(json =>
json.success
? dispatch({
type: ACTIONS.UPDATE_PUBLISH_FORM,
data: {
uploadThumbnailStatus: THUMBNAIL_STATUSES.COMPLETE,
thumbnail: `${json.data.url}${fileExt}`,
},
})
type: ACTIONS.UPDATE_PUBLISH_FORM,
data: {
uploadThumbnailStatus: THUMBNAIL_STATUSES.COMPLETE,
thumbnail: `${json.data.url}${fileExt}`,
},
})
: uploadError(json.message)
)
.catch(err => uploadError(err.message));
@ -194,10 +194,10 @@ export const doPrepareEdit = (claim: StreamClaim, uri: string, fileInfo: FileLis
const publishData: UpdatePublishFormData = {
name,
bid: amount,
contentIsFree: !fee.amount,
contentIsFree: fee.amount === '0',
author,
description,
fee: { amount: fee.amount, currency: fee.currency },
fee,
languages,
thumbnail: thumbnail ? thumbnail.url : null,
title,
@ -268,7 +268,6 @@ export const doPublish = (success: Function, fail: Function) => (
contentIsFree,
fee,
uri,
nsfw,
tags,
locations,
} = publishData;
@ -329,19 +328,13 @@ export const doPublish = (success: Function, fail: Function) => (
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) {
publishPayload.release_time = Number(myClaimForUri.value.release_time);
}
if (nsfw) {
if (!publishPayload.tags.includes('mature')) {
publishPayload.tags.push('mature');
}
} else if (myClaimForUri && myClaimForUri.timestamp) {
publishPayload.release_time = Number(myClaimForUri.timestamp);
} else {
const indexToRemove = publishPayload.tags.indexOf('mature');
if (indexToRemove > -1) {
publishPayload.tags.splice(indexToRemove, 1);
}
publishPayload.release_time = Number(Math.round(Date.now() / 1000));
}
if (channelId) {