Merge pull request #1481 from lbryio/publish-by-channel-id
Publish by channel_id
This commit is contained in:
commit
ea4c7d9d15
4 changed files with 18 additions and 10 deletions
|
@ -29,6 +29,8 @@ type Props = {
|
||||||
currency: string,
|
currency: string,
|
||||||
},
|
},
|
||||||
channel: string,
|
channel: string,
|
||||||
|
channelId: ?string,
|
||||||
|
myChannels: Array<{ name: string }>,
|
||||||
name: ?string,
|
name: ?string,
|
||||||
tosAccepted: boolean,
|
tosAccepted: boolean,
|
||||||
updatePublishForm: UpdatePublishFormData => void,
|
updatePublishForm: UpdatePublishFormData => void,
|
||||||
|
@ -137,13 +139,14 @@ class PublishForm extends React.PureComponent<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleChannelChange(channelName: string) {
|
handleChannelChange(channelName: string) {
|
||||||
const { name, updatePublishForm } = this.props;
|
const { name, updatePublishForm, myChannels } = this.props;
|
||||||
|
const form = { channel: channelName };
|
||||||
|
const namedChannelClaim = myChannels.find(channel => channel.name === channelName);
|
||||||
|
form.channelId = namedChannelClaim ? namedChannelClaim.claim_id : '';
|
||||||
if (name) {
|
if (name) {
|
||||||
const uri = this.getNewUri(name, channelName);
|
form.uri = this.getNewUri(name, channelName);
|
||||||
updatePublishForm({ channel: channelName, uri });
|
|
||||||
} else {
|
|
||||||
updatePublishForm({ channel: channelName });
|
|
||||||
}
|
}
|
||||||
|
updatePublishForm(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleBidChange(bid: number) {
|
handleBidChange(bid: number) {
|
||||||
|
@ -183,7 +186,7 @@ class PublishForm extends React.PureComponent<Props> {
|
||||||
description,
|
description,
|
||||||
language,
|
language,
|
||||||
nsfw,
|
nsfw,
|
||||||
channel,
|
channelId,
|
||||||
licenseType,
|
licenseType,
|
||||||
licenseUrl,
|
licenseUrl,
|
||||||
otherLicenseDescription,
|
otherLicenseDescription,
|
||||||
|
@ -217,7 +220,7 @@ class PublishForm extends React.PureComponent<Props> {
|
||||||
description,
|
description,
|
||||||
language,
|
language,
|
||||||
nsfw,
|
nsfw,
|
||||||
channel,
|
channelId,
|
||||||
license: publishingLicense,
|
license: publishingLicense,
|
||||||
licenseUrl: publishingLicenseUrl,
|
licenseUrl: publishingLicenseUrl,
|
||||||
otherLicenseDescription,
|
otherLicenseDescription,
|
||||||
|
|
|
@ -35,6 +35,7 @@ const select = (state, props) => {
|
||||||
|
|
||||||
const claimsByUri = selectClaimsByUri(state);
|
const claimsByUri = selectClaimsByUri(state);
|
||||||
const myClaims = selectMyClaims(state);
|
const myClaims = selectMyClaims(state);
|
||||||
|
const myChannels = selectMyChannelClaims(state);
|
||||||
|
|
||||||
const claimForUri = claimsByUri[uri];
|
const claimForUri = claimsByUri[uri];
|
||||||
let winningBidForClaimUri;
|
let winningBidForClaimUri;
|
||||||
|
@ -50,6 +51,7 @@ const select = (state, props) => {
|
||||||
claimForUri,
|
claimForUri,
|
||||||
winningBidForClaimUri,
|
winningBidForClaimUri,
|
||||||
myClaimForUri,
|
myClaimForUri,
|
||||||
|
myChannels,
|
||||||
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
||||||
balance: selectBalance(state),
|
balance: selectBalance(state),
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,7 +6,6 @@ import type {
|
||||||
UpdatePublishFormAction,
|
UpdatePublishFormAction,
|
||||||
PublishParams,
|
PublishParams,
|
||||||
} from 'redux/reducers/publish';
|
} from 'redux/reducers/publish';
|
||||||
import { CHANNEL_NEW, CHANNEL_ANONYMOUS } from 'constants/claim';
|
|
||||||
|
|
||||||
type Action = UpdatePublishFormAction | { type: ACTIONS.CLEAR_PUBLISH };
|
type Action = UpdatePublishFormAction | { type: ACTIONS.CLEAR_PUBLISH };
|
||||||
type PromiseAction = Promise<Action>;
|
type PromiseAction = Promise<Action>;
|
||||||
|
@ -86,6 +85,7 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
|
||||||
thumbnail,
|
thumbnail,
|
||||||
nsfw,
|
nsfw,
|
||||||
channel,
|
channel,
|
||||||
|
channelId,
|
||||||
title,
|
title,
|
||||||
contentIsFree,
|
contentIsFree,
|
||||||
price,
|
price,
|
||||||
|
@ -104,7 +104,6 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const channelName = channel === CHANNEL_ANONYMOUS || channel === CHANNEL_NEW ? '' : channel;
|
|
||||||
const fee = contentIsFree || !price.amount ? undefined : { ...price };
|
const fee = contentIsFree || !price.amount ? undefined : { ...price };
|
||||||
|
|
||||||
const metadata = {
|
const metadata = {
|
||||||
|
@ -126,7 +125,7 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
|
||||||
|
|
||||||
const publishPayload = {
|
const publishPayload = {
|
||||||
name,
|
name,
|
||||||
channel_name: channelName,
|
channel_id: channelId,
|
||||||
bid,
|
bid,
|
||||||
metadata,
|
metadata,
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,6 +18,7 @@ type PublishState = {
|
||||||
language: string,
|
language: string,
|
||||||
tosAccepted: boolean,
|
tosAccepted: boolean,
|
||||||
channel: string,
|
channel: string,
|
||||||
|
channelId: ?string,
|
||||||
name: string,
|
name: string,
|
||||||
nameError: ?string,
|
nameError: ?string,
|
||||||
bid: number,
|
bid: number,
|
||||||
|
@ -41,6 +42,7 @@ export type UpdatePublishFormData = {
|
||||||
language?: string,
|
language?: string,
|
||||||
tosAccepted?: boolean,
|
tosAccepted?: boolean,
|
||||||
channel?: string,
|
channel?: string,
|
||||||
|
channelId?: string,
|
||||||
name?: string,
|
name?: string,
|
||||||
nameError?: string,
|
nameError?: string,
|
||||||
bid?: number,
|
bid?: number,
|
||||||
|
@ -66,6 +68,7 @@ export type PublishParams = {
|
||||||
thumbnail: ?string,
|
thumbnail: ?string,
|
||||||
nsfw: boolean,
|
nsfw: boolean,
|
||||||
channel: string,
|
channel: string,
|
||||||
|
channelId: string,
|
||||||
title: string,
|
title: string,
|
||||||
contentIsFree: boolean,
|
contentIsFree: boolean,
|
||||||
uri: string,
|
uri: string,
|
||||||
|
@ -97,6 +100,7 @@ const defaultState: PublishState = {
|
||||||
language: 'en',
|
language: 'en',
|
||||||
nsfw: false,
|
nsfw: false,
|
||||||
channel: CHANNEL_ANONYMOUS,
|
channel: CHANNEL_ANONYMOUS,
|
||||||
|
channelId: '',
|
||||||
tosAccepted: false,
|
tosAccepted: false,
|
||||||
name: '',
|
name: '',
|
||||||
nameError: undefined,
|
nameError: undefined,
|
||||||
|
|
Loading…
Reference in a new issue