fix: allow metadata only edits

This commit is contained in:
Sean Yesmunt 2018-04-03 19:46:03 -04:00
parent 91c6764d31
commit 402bba5835
3 changed files with 25 additions and 1 deletions

View file

@ -38,6 +38,11 @@ type Props = {
winningBidForClaimUri: number, winningBidForClaimUri: number,
myClaimForUri: ?{ myClaimForUri: ?{
amount: number, amount: number,
value: {
stream: {
source: { source: string },
},
},
}, },
licenseType: string, licenseType: string,
otherLicenseDescription: ?string, otherLicenseDescription: ?string,
@ -187,6 +192,7 @@ class PublishForm extends React.PureComponent<Props> {
contentIsFree, contentIsFree,
price, price,
uri, uri,
myClaimForUri,
} = this.props; } = this.props;
let publishingLicense; let publishingLicense;
@ -222,6 +228,12 @@ class PublishForm extends React.PureComponent<Props> {
uri, uri,
}; };
// Editing a claim
if (!filePath && myClaimForUri) {
const { source } = myClaimForUri.value.stream;
publishParams.source = source;
}
publish(publishParams); publish(publishParams);
} }

View file

@ -84,6 +84,7 @@ export const doPublish = (params: PublishParams): ThunkAction => {
contentIsFree, contentIsFree,
price, price,
uri, uri,
source,
} = params; } = params;
const channelName = channel === CHANNEL_ANONYMOUS || channel === CHANNEL_NEW ? '' : channel; const channelName = channel === CHANNEL_ANONYMOUS || channel === CHANNEL_NEW ? '' : channel;
@ -107,13 +108,18 @@ export const doPublish = (params: PublishParams): ThunkAction => {
} }
const publishPayload = { const publishPayload = {
file_path: filePath,
name, name,
channel_name: channelName, channel_name: channelName,
bid, bid,
metadata, metadata,
}; };
if (filePath) {
publishPayload.file_path = filePath;
} else {
publishPayload.sources = source;
}
return (dispatch: Dispatch) => { return (dispatch: Dispatch) => {
dispatch({ type: ACTIONS.PUBLISH_START }); dispatch({ type: ACTIONS.PUBLISH_START });

View file

@ -75,6 +75,12 @@ export type PublishParams = {
currency: string, currency: string,
amount: number, amount: number,
}, },
source?: {
contentType: string,
source: string,
sourceType: string,
version: string,
},
}; };
const defaultState: PublishState = { const defaultState: PublishState = {