fix: address comments

And resolve on edit + balance check
This commit is contained in:
Thomas Zarebczan 2019-05-10 02:27:51 -04:00
parent 319636df80
commit 4f9f62f999
4 changed files with 16 additions and 16 deletions

View file

@ -71,10 +71,13 @@ class PublishForm extends React.PureComponent<Props> {
}
componentDidMount() {
const { thumbnail } = this.props;
const { thumbnail, name, channel, editingURI } = this.props;
if (!thumbnail) {
this.props.resetThumbnailStatus();
}
if (editingURI) {
this.getNewUri(name, channel);
}
}
getNewUri(name: string, channel: string) {
@ -156,7 +159,7 @@ class PublishForm extends React.PureComponent<Props> {
let previousBidAmount = 0;
if (myClaimForUri) {
previousBidAmount = myClaimForUri.amount;
previousBidAmount = Number(myClaimForUri.amount);
}
const totalAvailableBidAmount = previousBidAmount + balance;
@ -217,8 +220,7 @@ class PublishForm extends React.PureComponent<Props> {
otherLicenseDescription,
name: this.props.name || undefined,
contentIsFree: this.props.contentIsFree,
feeAmount: this.props.fee.amount,
feeCurrency: this.props.fee.currency,
fee: this.props.fee,
uri: this.props.uri || undefined,
channel: this.props.channel,
isStillEditing: this.props.isStillEditing,

View file

@ -33,8 +33,7 @@ export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim) {
// If the file is for a claim we published then also abandon the claim
const myClaimsOutpoints = selectMyClaimsOutpoints(state);
if (abandonClaim && myClaimsOutpoints.indexOf(outpoint) !== -1) {
const txid = outpoint.slice(0, -2);
const nout = Number(outpoint.slice(-1));
const [txid, nout] = outpoint.split(':');
dispatch(doAbandonClaim(txid, nout));
}

View file

@ -206,8 +206,7 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
channel,
title,
contentIsFree,
feeAmount,
feeCurrency,
fee,
uri,
nsfw,
claim,
@ -234,7 +233,7 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
license,
languages: [language],
description,
tags: claim && claim.value.tags,
tags: (claim && claim.value.tags) || [],
locations: claim && claim.value.locations,
};
@ -255,11 +254,11 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
}
if (nsfw) {
if (publishPayload.tags && !publishPayload.tags.includes('mature')) {
if (!publishPayload.tags.includes('mature')) {
publishPayload.tags.push('mature');
}
} else {
const remove = publishPayload.tags && publishPayload.tags.indexOf('mature');
const remove = publishPayload.tags.indexOf('mature');
if (remove > -1) {
publishPayload.tags.splice(remove, 1);
}
@ -269,9 +268,9 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
publishPayload.channel_id = channelId;
}
if (!contentIsFree && (feeCurrency && Number(feeAmount) > 0)) {
publishPayload.fee_currency = feeCurrency;
publishPayload.fee_amount = creditsToString(feeAmount);
if (!contentIsFree && (fee.currency && Number(fee.amount) > 0)) {
publishPayload.fee_currency = fee.currency;
publishPayload.fee_amount = creditsToString(fee.amount);
}
// Only pass file on new uploads, not metadata only edits.

View file

@ -9,7 +9,7 @@ type PublishState = {
editingURI: ?string,
filePath: ?string,
contentIsFree: boolean,
price: {
fee: {
amount: number,
currency: string,
},
@ -33,7 +33,7 @@ const defaultState: PublishState = {
editingURI: undefined,
filePath: undefined,
contentIsFree: true,
price: {
fee: {
amount: 1,
currency: 'LBC',
},