mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-12 05:19:47 +00:00
remove copyright and fix other license edit
This commit is contained in:
parent
36d3235a5f
commit
23ae86e0e7
4 changed files with 31 additions and 36 deletions
|
@ -5,13 +5,11 @@ import { CC_LICENSES, COPYRIGHT, OTHER, PUBLIC_DOMAIN, NONE } from 'constants/li
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
licenseType: string,
|
licenseType: string,
|
||||||
copyrightNotice: ?string,
|
|
||||||
licenseUrl: ?string,
|
licenseUrl: ?string,
|
||||||
otherLicenseDescription: ?string,
|
otherLicenseDescription: ?string,
|
||||||
handleLicenseChange: (string, string) => void,
|
handleLicenseChange: (string, string) => void,
|
||||||
handleLicenseDescriptionChange: (SyntheticInputEvent<*>) => void,
|
handleLicenseDescriptionChange: (SyntheticInputEvent<*>) => void,
|
||||||
handleLicenseUrlChange: (SyntheticInputEvent<*>) => void,
|
handleLicenseUrlChange: (SyntheticInputEvent<*>) => void,
|
||||||
handleCopyrightNoticeChange: (SyntheticInputEvent<*>) => void,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class LicenseType extends React.PureComponent<Props> {
|
class LicenseType extends React.PureComponent<Props> {
|
||||||
|
@ -38,11 +36,8 @@ class LicenseType extends React.PureComponent<Props> {
|
||||||
licenseType,
|
licenseType,
|
||||||
otherLicenseDescription,
|
otherLicenseDescription,
|
||||||
licenseUrl,
|
licenseUrl,
|
||||||
copyrightNotice,
|
|
||||||
handleLicenseChange,
|
|
||||||
handleLicenseDescriptionChange,
|
handleLicenseDescriptionChange,
|
||||||
handleLicenseUrlChange,
|
handleLicenseUrlChange,
|
||||||
handleCopyrightNoticeChange,
|
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -72,8 +67,8 @@ class LicenseType extends React.PureComponent<Props> {
|
||||||
label={__('Copyright notice')}
|
label={__('Copyright notice')}
|
||||||
type="text"
|
type="text"
|
||||||
name="copyright-notice"
|
name="copyright-notice"
|
||||||
value={copyrightNotice}
|
value={otherLicenseDescription}
|
||||||
onChange={handleCopyrightNoticeChange}
|
onChange={handleLicenseDescriptionChange}
|
||||||
/>
|
/>
|
||||||
</FormRow>
|
</FormRow>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -45,7 +45,6 @@ type Props = {
|
||||||
licenseType: string,
|
licenseType: string,
|
||||||
otherLicenseDescription: ?string,
|
otherLicenseDescription: ?string,
|
||||||
licenseUrl: ?string,
|
licenseUrl: ?string,
|
||||||
copyrightNotice: ?string,
|
|
||||||
uri: ?string,
|
uri: ?string,
|
||||||
bidError: ?string,
|
bidError: ?string,
|
||||||
publishing: boolean,
|
publishing: boolean,
|
||||||
|
@ -200,7 +199,6 @@ class PublishForm extends React.PureComponent<Props> {
|
||||||
handlePublish() {
|
handlePublish() {
|
||||||
const {
|
const {
|
||||||
filePath,
|
filePath,
|
||||||
copyrightNotice,
|
|
||||||
licenseType,
|
licenseType,
|
||||||
licenseUrl,
|
licenseUrl,
|
||||||
otherLicenseDescription,
|
otherLicenseDescription,
|
||||||
|
@ -211,8 +209,6 @@ class PublishForm extends React.PureComponent<Props> {
|
||||||
let publishingLicense;
|
let publishingLicense;
|
||||||
switch (licenseType) {
|
switch (licenseType) {
|
||||||
case COPYRIGHT:
|
case COPYRIGHT:
|
||||||
publishingLicense = copyrightNotice;
|
|
||||||
break;
|
|
||||||
case OTHER:
|
case OTHER:
|
||||||
publishingLicense = otherLicenseDescription;
|
publishingLicense = otherLicenseDescription;
|
||||||
break;
|
break;
|
||||||
|
@ -233,7 +229,6 @@ class PublishForm extends React.PureComponent<Props> {
|
||||||
license: publishingLicense,
|
license: publishingLicense,
|
||||||
licenseUrl: publishingLicenseUrl,
|
licenseUrl: publishingLicenseUrl,
|
||||||
otherLicenseDescription,
|
otherLicenseDescription,
|
||||||
copyrightNotice,
|
|
||||||
name: this.props.name,
|
name: this.props.name,
|
||||||
contentIsFree: this.props.contentIsFree,
|
contentIsFree: this.props.contentIsFree,
|
||||||
price: this.props.price,
|
price: this.props.price,
|
||||||
|
@ -339,7 +334,6 @@ class PublishForm extends React.PureComponent<Props> {
|
||||||
licenseType,
|
licenseType,
|
||||||
otherLicenseDescription,
|
otherLicenseDescription,
|
||||||
licenseUrl,
|
licenseUrl,
|
||||||
copyrightNotice,
|
|
||||||
uri,
|
uri,
|
||||||
bidError,
|
bidError,
|
||||||
publishing,
|
publishing,
|
||||||
|
@ -585,7 +579,6 @@ class PublishForm extends React.PureComponent<Props> {
|
||||||
licenseType={licenseType}
|
licenseType={licenseType}
|
||||||
otherLicenseDescription={otherLicenseDescription}
|
otherLicenseDescription={otherLicenseDescription}
|
||||||
licenseUrl={licenseUrl}
|
licenseUrl={licenseUrl}
|
||||||
copyrightNotice={copyrightNotice}
|
|
||||||
handleLicenseChange={(newLicenseType, newLicenseUrl) =>
|
handleLicenseChange={(newLicenseType, newLicenseUrl) =>
|
||||||
updatePublishForm({
|
updatePublishForm({
|
||||||
licenseType: newLicenseType,
|
licenseType: newLicenseType,
|
||||||
|
@ -600,9 +593,6 @@ class PublishForm extends React.PureComponent<Props> {
|
||||||
handleLicenseUrlChange={event =>
|
handleLicenseUrlChange={event =>
|
||||||
updatePublishForm({ licenseUrl: event.target.value })
|
updatePublishForm({ licenseUrl: event.target.value })
|
||||||
}
|
}
|
||||||
handleCopyrightNoticeChange={event =>
|
|
||||||
updatePublishForm({ copyrightNotice: event.target.value })
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
|
@ -18,25 +18,13 @@ import { selectosNotificationsEnabled } from 'redux/selectors/settings';
|
||||||
import { doNavigate } from 'redux/actions/navigation';
|
import { doNavigate } from 'redux/actions/navigation';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
import { CC_LICENSES, COPYRIGHT, OTHER } from 'constants/licenses';
|
||||||
|
|
||||||
type Action = UpdatePublishFormAction | { type: ACTIONS.CLEAR_PUBLISH };
|
type Action = UpdatePublishFormAction | { type: ACTIONS.CLEAR_PUBLISH };
|
||||||
type PromiseAction = Promise<Action>;
|
type PromiseAction = Promise<Action>;
|
||||||
type Dispatch = (action: Action | PromiseAction | Array<Action>) => any;
|
type Dispatch = (action: Action | PromiseAction | Array<Action>) => any;
|
||||||
type GetState = () => {};
|
type GetState = () => {};
|
||||||
|
|
||||||
export const doClearPublish = () => (dispatch: Dispatch): PromiseAction => {
|
|
||||||
dispatch({ type: ACTIONS.CLEAR_PUBLISH });
|
|
||||||
return dispatch(doResetThumbnailStatus());
|
|
||||||
};
|
|
||||||
|
|
||||||
export const doUpdatePublishForm = (publishFormValue: UpdatePublishFormData) => (
|
|
||||||
dispatch: Dispatch
|
|
||||||
): UpdatePublishFormAction =>
|
|
||||||
dispatch({
|
|
||||||
type: ACTIONS.UPDATE_PUBLISH_FORM,
|
|
||||||
data: { ...publishFormValue },
|
|
||||||
});
|
|
||||||
|
|
||||||
export const doResetThumbnailStatus = () => (dispatch: Dispatch): PromiseAction => {
|
export const doResetThumbnailStatus = () => (dispatch: Dispatch): PromiseAction => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.UPDATE_PUBLISH_FORM,
|
type: ACTIONS.UPDATE_PUBLISH_FORM,
|
||||||
|
@ -73,6 +61,19 @@ export const doResetThumbnailStatus = () => (dispatch: Dispatch): PromiseAction
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const doClearPublish = () => (dispatch: Dispatch): PromiseAction => {
|
||||||
|
dispatch({ type: ACTIONS.CLEAR_PUBLISH });
|
||||||
|
return dispatch(doResetThumbnailStatus());
|
||||||
|
};
|
||||||
|
|
||||||
|
export const doUpdatePublishForm = (publishFormValue: UpdatePublishFormData) => (
|
||||||
|
dispatch: Dispatch
|
||||||
|
): UpdatePublishFormAction =>
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.UPDATE_PUBLISH_FORM,
|
||||||
|
data: { ...publishFormValue },
|
||||||
|
});
|
||||||
|
|
||||||
export const doUploadThumbnail = (filePath: string, nsfw: boolean) => (dispatch: Dispatch) => {
|
export const doUploadThumbnail = (filePath: string, nsfw: boolean) => (dispatch: Dispatch) => {
|
||||||
const thumbnail = fs.readFileSync(filePath);
|
const thumbnail = fs.readFileSync(filePath);
|
||||||
const fileExt = path.extname(filePath);
|
const fileExt = path.extname(filePath);
|
||||||
|
@ -164,15 +165,27 @@ export const doPrepareEdit = (claim: any, uri: string) => (dispatch: Dispatch) =
|
||||||
description,
|
description,
|
||||||
fee,
|
fee,
|
||||||
language,
|
language,
|
||||||
licenseType: license,
|
|
||||||
licenseUrl,
|
|
||||||
nsfw,
|
nsfw,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
title,
|
title,
|
||||||
uri,
|
uri,
|
||||||
uploadThumbnailStatus: thumbnail ? THUMBNAIL_STATUSES.MANUAL : undefined,
|
uploadThumbnailStatus: thumbnail ? THUMBNAIL_STATUSES.MANUAL : undefined,
|
||||||
|
licenseUrl,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Make sure custom liscence's are mapped properly
|
||||||
|
if (!CC_LICENSES.some(({ value }) => value === license)) {
|
||||||
|
if (!licenseUrl) {
|
||||||
|
publishData.licenseType = COPYRIGHT;
|
||||||
|
} else {
|
||||||
|
publishData.licenseType = OTHER;
|
||||||
|
}
|
||||||
|
|
||||||
|
publishData.otherLicenseDescription = license;
|
||||||
|
} else {
|
||||||
|
publishData.licenseType = license;
|
||||||
|
}
|
||||||
|
|
||||||
dispatch({ type: ACTIONS.DO_PREPARE_EDIT, data: publishData });
|
dispatch({ type: ACTIONS.DO_PREPARE_EDIT, data: publishData });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ type PublishState = {
|
||||||
bidError: ?string,
|
bidError: ?string,
|
||||||
otherLicenseDescription: string,
|
otherLicenseDescription: string,
|
||||||
licenseUrl: string,
|
licenseUrl: string,
|
||||||
copyrightNotice: string,
|
|
||||||
pendingPublishes: Array<any>,
|
pendingPublishes: Array<any>,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -54,7 +53,6 @@ export type UpdatePublishFormData = {
|
||||||
bidError?: string,
|
bidError?: string,
|
||||||
otherLicenseDescription?: string,
|
otherLicenseDescription?: string,
|
||||||
licenseUrl?: string,
|
licenseUrl?: string,
|
||||||
copyrightNotice?: string,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type UpdatePublishFormAction = {
|
export type UpdatePublishFormAction = {
|
||||||
|
@ -114,9 +112,8 @@ const defaultState: PublishState = {
|
||||||
bid: 0.1,
|
bid: 0.1,
|
||||||
bidError: undefined,
|
bidError: undefined,
|
||||||
licenseType: 'None',
|
licenseType: 'None',
|
||||||
otherLicenseDescription: '',
|
otherLicenseDescription: 'All rights reserved',
|
||||||
licenseUrl: '',
|
licenseUrl: '',
|
||||||
copyrightNotice: 'All rights reserved',
|
|
||||||
publishing: false,
|
publishing: false,
|
||||||
publishSuccess: false,
|
publishSuccess: false,
|
||||||
publishError: undefined,
|
publishError: undefined,
|
||||||
|
|
Loading…
Add table
Reference in a new issue