Adds License and LicenseUrl to AssetInfo and Publish/Edit Forms #935
|
@ -1,6 +1,7 @@
|
||||||
select {
|
select {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
background: $base-color;
|
background: $background-color;
|
||||||
border: 0;
|
border: 0;
|
||||||
|
color: $text-color;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,6 @@ const ChannelSelectDropdown = ({ selectedChannel, handleSelection, loggedInChann
|
||||||
id='channel-name-select'
|
id='channel-name-select'
|
||||||
value={selectedChannel}
|
value={selectedChannel}
|
||||||
onChange={handleSelection}>
|
onChange={handleSelection}>
|
||||||
{ loggedInChannelName && (
|
|
||||||
<option value={loggedInChannelName} >{loggedInChannelName}</option>
|
|
||||||
)}
|
|
||||||
<option value={LOGIN}>Existing</option>
|
<option value={LOGIN}>Existing</option>
|
||||||
<option value={CREATE}>New</option>
|
<option value={CREATE}>New</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
We should have a more suitable alias to use instead of the We should have a more suitable alias to use instead of the `../../`
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import RowLabeled from '@components/RowLabeled';
|
import RowLabeled from '@components/RowLabeled';
|
||||||
import Label from '@components/Label';
|
import Label from '@components/Label';
|
||||||
import { LICENSES } from '../../constants/publish_license_urls';
|
import { LICENSES } from '@clientConstants/publish_license_urls';
|
||||||
We should have a more suitable alias to use instead of the We should have a more suitable alias to use instead of the `../../`
We should have a more suitable alias to use instead of the We should have a more suitable alias to use instead of the `../../`
|
|||||||
|
|
||||||
const PublishLicenseInput = ({ handleSelect }) => {
|
const PublishLicenseInput = ({ handleSelect, license }) => {
|
||||||
We should have a more suitable alias to use instead of the We should have a more suitable alias to use instead of the `../../`
We should have a more suitable alias to use instead of the We should have a more suitable alias to use instead of the `../../`
|
|||||||
return (
|
return (
|
||||||
<RowLabeled
|
<RowLabeled
|
||||||
label={
|
label={
|
||||||
|
@ -14,6 +14,7 @@ const PublishLicenseInput = ({ handleSelect }) => {
|
||||||
We should have a more suitable alias to use instead of the We should have a more suitable alias to use instead of the `../../`
We should have a more suitable alias to use instead of the We should have a more suitable alias to use instead of the `../../`
|
|||||||
type='text'
|
type='text'
|
||||||
name='license'
|
name='license'
|
||||||
id='publish-license'
|
id='publish-license'
|
||||||
|
value={license}
|
||||||
We should have a more suitable alias to use instead of the We should have a more suitable alias to use instead of the `../../`
|
|||||||
onChange={handleSelect}
|
onChange={handleSelect}
|
||||||
>
|
>
|
||||||
<option value=''>Unspecified</option>
|
<option value=''>Unspecified</option>
|
||||||
|
|
||||||
We should have a more suitable alias to use instead of the We should have a more suitable alias to use instead of the `../../`
We should have a more suitable alias to use instead of the We should have a more suitable alias to use instead of the `../../`
|
|
@ -1,9 +1,9 @@
|
||||||
alias alias
alias alias
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import RowLabeled from '@components/RowLabeled';
|
import RowLabeled from '@components/RowLabeled';
|
||||||
import Label from '@components/Label';
|
import Label from '@components/Label';
|
||||||
import { CC_LICENSES } from '../../constants/publish_license_urls';
|
import { CC_LICENSES } from '@clientConstants/publish_license_urls';
|
||||||
alias alias
alias alias
|
|||||||
|
|
||||||
const PublishLicenseUrlInput = ({ handleSelect }) => {
|
const PublishLicenseUrlInput = ({ handleSelect, licenseUrl }) => {
|
||||||
alias alias
alias alias
|
|||||||
return (
|
return (
|
||||||
<RowLabeled
|
<RowLabeled
|
||||||
label={
|
label={
|
||||||
|
@ -14,6 +14,7 @@ const PublishLicenseUrlInput = ({ handleSelect }) => {
|
||||||
alias alias
alias alias
|
|||||||
type='text'
|
type='text'
|
||||||
name='licenseUrl'
|
name='licenseUrl'
|
||||||
id='publish-license-url'
|
id='publish-license-url'
|
||||||
|
value={licenseUrl}
|
||||||
alias alias
|
|||||||
onChange={handleSelect}
|
onChange={handleSelect}
|
||||||
>
|
>
|
||||||
<option value=''>Unspecified</option>
|
<option value=''>Unspecified</option>
|
||||||
|
|
||||||
alias alias
alias alias
|
|
@ -7,7 +7,7 @@ import AssetShareButtons from '@components/AssetShareButtons';
|
||||||
import ClickToCopy from '@components/ClickToCopy';
|
import ClickToCopy from '@components/ClickToCopy';
|
||||||
import siteConfig from '@config/siteConfig.json';
|
import siteConfig from '@config/siteConfig.json';
|
||||||
import createCanonicalLink from '@globalutils/createCanonicalLink';
|
import createCanonicalLink from '@globalutils/createCanonicalLink';
|
||||||
import AssetInfoFooter from '../../components/AssetInfoFooter/index';
|
import AssetInfoFooter from '@components/AssetInfoFooter/index';
|
||||||
import { createPermanentURI } from '@clientutils/createPermanentURI';
|
import { createPermanentURI } from '@clientutils/createPermanentURI';
|
||||||
import ReactMarkdown from 'react-markdown';
|
import ReactMarkdown from 'react-markdown';
|
||||||
|
|
||||||
|
@ -18,7 +18,20 @@ class AssetInfo extends React.Component {
|
||||||
render () {
|
render () {
|
||||||
const { editable, asset } = this.props;
|
const { editable, asset } = this.props;
|
||||||
const { claimViews, claimData } = asset;
|
const { claimViews, claimData } = asset;
|
||||||
const { channelName, claimId, channelShortId, description, name, fileExt, contentType, host, certificateId, license, licenseUrl, transactionTime } = claimData;
|
const {
|
||||||
|
channelName,
|
||||||
|
claimId,
|
||||||
|
channelShortId,
|
||||||
|
description,
|
||||||
|
name,
|
||||||
|
fileExt,
|
||||||
|
contentType,
|
||||||
|
host,
|
||||||
|
certificateId,
|
||||||
|
license,
|
||||||
|
licenseUrl,
|
||||||
|
transactionTime
|
||||||
|
} = claimData;
|
||||||
|
|
||||||
const canonicalUrl = createCanonicalLink({ asset: { ...claimData, shortId: asset.shortId }});
|
const canonicalUrl = createCanonicalLink({ asset: { ...claimData, shortId: asset.shortId }});
|
||||||
const assetCanonicalUrl = `${host}${canonicalUrl}`;
|
const assetCanonicalUrl = `${host}${canonicalUrl}`;
|
||||||
|
@ -55,7 +68,7 @@ class AssetInfo extends React.Component {
|
||||||
{editable && (
|
{editable && (
|
||||||
<RowLabeled
|
<RowLabeled
|
||||||
label={<Label value={'Edit'} />}
|
label={<Label value={'Edit'} />}
|
||||||
content={<Link to={`/edit${canonicalUrl}`}>{name}</Link>}
|
content={<Link className='link--primary' to={`/edit${canonicalUrl}`}>{name}</Link>}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{channelName && (
|
{channelName && (
|
||||||
|
@ -72,6 +85,18 @@ class AssetInfo extends React.Component {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<SpaceBetween>
|
<SpaceBetween>
|
||||||
|
{claimViews ? (
|
||||||
|
<RowLabeled
|
||||||
|
label={
|
||||||
|
<Label value={'Views'} />
|
||||||
|
}
|
||||||
|
content={
|
||||||
|
<span className='text'>
|
||||||
|
{claimViews}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
{license && (
|
{license && (
|
||||||
<RowLabeled
|
<RowLabeled
|
||||||
label={
|
label={
|
||||||
|
@ -87,19 +112,6 @@ class AssetInfo extends React.Component {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{claimViews ? (
|
|
||||||
<RowLabeled
|
|
||||||
label={
|
|
||||||
<Label value={'Views'} />
|
|
||||||
}
|
|
||||||
content={
|
|
||||||
<span className='text'>
|
|
||||||
{claimViews}
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
</SpaceBetween>
|
</SpaceBetween>
|
||||||
<RowLabeled
|
<RowLabeled
|
||||||
label={
|
label={
|
||||||
|
|
|
@ -18,10 +18,10 @@ class ChannelSelect extends React.Component {
|
||||||
componentWillMount () {
|
componentWillMount () {
|
||||||
const { loggedInChannelName, onChannelSelect, publishOnlyApproved, onPublishInChannelChange } = this.props;
|
const { loggedInChannelName, onChannelSelect, publishOnlyApproved, onPublishInChannelChange } = this.props;
|
||||||
if (loggedInChannelName) {
|
if (loggedInChannelName) {
|
||||||
this.props.onPublishInChannelChange(true);
|
onChannelSelect(loggedInChannelName);
|
||||||
}
|
}
|
||||||
if (publishOnlyApproved) {
|
if (publishOnlyApproved) {
|
||||||
this.props.onPublishInChannelChange(true);
|
onPublishInChannelChange(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
toggleAnonymousPublish (event) {
|
toggleAnonymousPublish (event) {
|
||||||
|
@ -37,10 +37,7 @@ class ChannelSelect extends React.Component {
|
||||||
this.props.onChannelSelect(selectedOption);
|
this.props.onChannelSelect(selectedOption);
|
||||||
}
|
}
|
||||||
render () {
|
render () {
|
||||||
let { publishInChannel, channelError, selectedChannel, loggedInChannelName, publishOnlyApproved } = this.props;
|
const { publishInChannel, channelError, selectedChannel, loggedInChannelName, publishOnlyApproved } = this.props;
|
||||||
if (loggedInChannelName) {
|
|
||||||
publishInChannel = 'checked';
|
|
||||||
}
|
|
||||||
if (publishOnlyApproved) {
|
if (publishOnlyApproved) {
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
|
|
@ -30,25 +30,27 @@ class PublishMetadataInputs extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
render () {
|
render () {
|
||||||
const { showMetadataInputs, description, isUpdate, nsfw } = this.props;
|
const { showMetadataInputs, description, isUpdate, nsfw, license, licenseUrl } = this.props;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{(showMetadataInputs || isUpdate) && (
|
{(showMetadataInputs || isUpdate) && (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<PublishDescriptionInput
|
<PublishDescriptionInput
|
||||||
description={this.props.description}
|
description={description}
|
||||||
handleInput={this.handleInput}
|
handleInput={this.handleInput}
|
||||||
/>
|
/>
|
||||||
<PublishLicenseInput
|
<PublishLicenseInput
|
||||||
handleSelect={this.handleSelect}
|
handleSelect={this.handleSelect}
|
||||||
|
license={license}
|
||||||
/>
|
/>
|
||||||
{ (this.props.license === 'Creative Commons') && (
|
{ (this.props.license === 'Creative Commons') && (
|
||||||
<PublishLicenseUrlInput
|
<PublishLicenseUrlInput
|
||||||
handleSelect={this.handleSelect}
|
handleSelect={this.handleSelect}
|
||||||
|
licenseUrl={licenseUrl}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<PublishNsfwInput
|
<PublishNsfwInput
|
||||||
nsfw={this.props.nsfw}
|
nsfw={nsfw}
|
||||||
handleInput={this.handleInput}
|
handleInput={this.handleInput}
|
||||||
/>
|
/>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
|
|
|
@ -6,7 +6,7 @@ const {
|
||||||
|
|
||||||
const getterMethods = {
|
const getterMethods = {
|
||||||
generated_extension() {
|
generated_extension() {
|
||||||
logger.info('trying to generate extension', this.content_type);
|
logger.debug('trying to generate extension', this.content_type);
|
||||||
if (customFileExtensions.hasOwnProperty(this.content_type)) {
|
if (customFileExtensions.hasOwnProperty(this.content_type)) {
|
||||||
return customFileExtensions[this.content_type];
|
return customFileExtensions[this.content_type];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -51,7 +51,7 @@ export default (db, table, sequelize) => ({
|
||||||
},
|
},
|
||||||
|
|
||||||
getShortClaimIdFromLongClaimId: async (claimId, claimName, pendingClaim) => {
|
getShortClaimIdFromLongClaimId: async (claimId, claimName, pendingClaim) => {
|
||||||
logger.info(`claim.getShortClaimIdFromLongClaimId for ${claimName}#${claimId}`);
|
logger.debug(`claim.getShortClaimIdFromLongClaimId for ${claimName}#${claimId}`);
|
||||||
return await table
|
return await table
|
||||||
.findAll({
|
.findAll({
|
||||||
where: { name: claimName },
|
where: { name: claimName },
|
||||||
|
|
|
@ -4,7 +4,7 @@ const getClaimData = require('server/utils/getClaimData');
|
||||||
const { returnPaginatedChannelClaims } = require('./channelPagination.js');
|
const { returnPaginatedChannelClaims } = require('./channelPagination.js');
|
||||||
|
|
||||||
const getChannelClaims = async (channelName, channelLongId, page) => {
|
const getChannelClaims = async (channelName, channelLongId, page) => {
|
||||||
logger.info(`getChannelClaims: ${channelName}, ${channelLongId}, ${page}`);
|
logger.debug(`getChannelClaims: ${channelName}, ${channelLongId}, ${page}`);
|
||||||
let channelShortId = await chainquery.claim.queries.getShortClaimIdFromLongClaimId(
|
let channelShortId = await chainquery.claim.queries.getShortClaimIdFromLongClaimId(
|
||||||
channelLongId,
|
channelLongId,
|
||||||
channelName
|
channelName
|
||||||
|
|
|
@ -5,7 +5,7 @@ const {
|
||||||
Would you mind cleaning up this path while you're here? Would you mind cleaning up this path while you're here?
Would you mind cleaning up this path while you're here? Would you mind cleaning up this path while you're here?
|
|||||||
publishing: { disabled, disabledMessage },
|
publishing: { disabled, disabledMessage },
|
||||||
} = require('@config/siteConfig');
|
} = require('@config/siteConfig');
|
||||||
|
|
||||||
const { sendGATimingEvent } = require('../../../../utils/googleAnalytics.js');
|
const { sendGATimingEvent } = require('server/utils/googleAnalytics.js');
|
||||||
Would you mind cleaning up this path while you're here? Would you mind cleaning up this path while you're here?
Would you mind cleaning up this path while you're here? Would you mind cleaning up this path while you're here?
|
|||||||
const isApprovedChannel = require('@globalutils/isApprovedChannel');
|
const isApprovedChannel = require('@globalutils/isApprovedChannel');
|
||||||
const {
|
const {
|
||||||
publishing: { publishOnlyApproved, approvedChannels },
|
publishing: { publishOnlyApproved, approvedChannels },
|
||||||
|
|
||||||
Would you mind cleaning up this path while you're here? Would you mind cleaning up this path while you're here?
Would you mind cleaning up this path while you're here? Would you mind cleaning up this path while you're here?
|
|
@ -129,7 +129,7 @@ const claimUpdate = ({ body, files, headers, ip, originalUrl, user, tor }, res)
|
||||||
description: claimRecord.description,
|
description: claimRecord.description,
|
||||||
nsfw: claimRecord.nsfw,
|
nsfw: claimRecord.nsfw,
|
||||||
license: claimRecord.license,
|
license: claimRecord.license,
|
||||||
license_url: claimRecord.license_url,
|
licenseUrl: claimRecord.license_url,
|
||||||
language: 'en',
|
language: 'en',
|
||||||
author: details.title,
|
author: details.title,
|
||||||
},
|
},
|
||||||
|
@ -170,12 +170,10 @@ const claimUpdate = ({ body, files, headers, ip, originalUrl, user, tor }, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
const fp = files && files.file && files.file.path ? files.file.path : undefined;
|
const fp = files && files.file && files.file.path ? files.file.path : undefined;
|
||||||
logger.info(`before updatepublish`);
|
|
||||||
return publish(publishParams, fileName, fileType, fp);
|
return publish(publishParams, fileName, fileType, fp);
|
||||||
})
|
})
|
||||||
.then(result => {
|
.then(result => {
|
||||||
publishResult = result;
|
publishResult = result;
|
||||||
logger.info(`after updatepublish then`, result);
|
|
||||||
|
|
||||||
if (channelName) {
|
if (channelName) {
|
||||||
return chainquery.claim.queries.getShortClaimIdFromLongClaimId(
|
return chainquery.claim.queries.getShortClaimIdFromLongClaimId(
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const logger = require('winston');
|
const logger = require('winston');
|
||||||
const transformImage = require('./transformImage');
|
const transformImage = require('./transformImage');
|
||||||
|
|
||||||
const serveFile = async ({ filePath, fileType }, res, originalUrl) => {
|
const serveFile = async ({ filePath, fileType }, res, originalUrl) => {
|
||||||
const queryObject = {};
|
const queryObject = {};
|
||||||
// TODO: replace quick/dirty try catch with better practice
|
// TODO: replace quick/dirty try catch with better practice
|
||||||
|
|
|
@ -39,6 +39,9 @@ module.exports = () => {
|
||||||
moduleAliases['@clientutils'] = resolve(`${DEFAULT_ROOT}/utils`);
|
moduleAliases['@clientutils'] = resolve(`${DEFAULT_ROOT}/utils`);
|
||||||
// moduleAliases['@serverutils'] = resolve('server/utils');
|
// moduleAliases['@serverutils'] = resolve('server/utils');
|
||||||
|
|
||||||
|
// aliases for constants
|
||||||
|
moduleAliases['@clientConstants'] = resolve(`${DEFAULT_ROOT}/constants`);
|
||||||
|
|
||||||
// create specific aliases for locally defined components in the following folders
|
// create specific aliases for locally defined components in the following folders
|
||||||
moduleAliases = addAliasesForCustomComponentFolder('containers', moduleAliases);
|
moduleAliases = addAliasesForCustomComponentFolder('containers', moduleAliases);
|
||||||
moduleAliases = addAliasesForCustomComponentFolder('components', moduleAliases);
|
moduleAliases = addAliasesForCustomComponentFolder('components', moduleAliases);
|
||||||
|
@ -53,7 +56,6 @@ module.exports = () => {
|
||||||
moduleAliases['@sagas'] = resolve(`${DEFAULT_ROOT}/sagas`);
|
moduleAliases['@sagas'] = resolve(`${DEFAULT_ROOT}/sagas`);
|
||||||
moduleAliases['@app'] = resolve(`${DEFAULT_ROOT}/app.js`);
|
moduleAliases['@app'] = resolve(`${DEFAULT_ROOT}/app.js`);
|
||||||
|
|
||||||
|
|
||||||
// return finished aliases
|
// return finished aliases
|
||||||
return moduleAliases;
|
return moduleAliases;
|
||||||
};
|
};
|
||||||
|
|
We should have a more suitable alias to use instead of the
../../