Skip to content

Commit

Permalink
address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed Dec 20, 2022
1 parent 852d8e5 commit 95ad5f7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@ import { store as coreStore } from '@wordpress/core-data';
const getExternalLink = ( url, text ) =>
`<a href="${ url }" target="_blank" rel="noreferrer noopener">${ text }</a>`;

const getOpenvereLicense = (
license,
licenseVersion = '', // unknown version.
licenseUrl
) => {
const getOpenvereLicense = ( license, licenseVersion, licenseUrl ) => {
let licenseName = license.trim();
// PDM has no abbreviation
if ( license !== 'pdm' ) {
licenseName = license.toUpperCase().replace( 'SAMPLING', 'Sampling' );
}
// If version is known, append version to the name.
// The license has to have a version to be valid. Only
// PDM (public domain mark) doesn't have a version.
if ( licenseVersion ) {
licenseName += ` ${ licenseVersion }`;
}
Expand Down Expand Up @@ -54,19 +52,18 @@ const getOpenvereLicense = (

const getOpenverseCaption = ( item ) => {
const {
/* translators: Openverse default media item title in the block inserter's media list. (ex. 'This work by {creator} is marked with CC0 1.0'). */
title = __( 'This work' ),
title,
foreign_landing_url: foreignLandingUrl,
creator,
creator_url: creatorUrl,
license,
license_version: licenseVersion,
license_url: licenseUrl,
} = item;
let _title = decodeEntities( title );
if ( !! foreignLandingUrl ) {
_title = getExternalLink( foreignLandingUrl, _title );
}
/* translators: Openverse default media item title in the block inserter's media list. (ex. 'This work by {creator} is marked with CC0 1.0'). */
const defaultTitle = __( 'This work' );
let _title = title ? decodeEntities( title ) : defaultTitle;
_title = getExternalLink( foreignLandingUrl, _title );
const fullLicense = getOpenvereLicense(
license,
licenseVersion,
Expand Down
19 changes: 8 additions & 11 deletions packages/editor/src/components/media-categories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@ import { store as coreStore } from '@wordpress/core-data';
const getExternalLink = ( url, text ) =>
`<a href="${ url }" target="_blank" rel="noreferrer noopener">${ text }</a>`;

const getOpenvereLicense = (
license,
licenseVersion = '', // unknown version.
licenseUrl
) => {
const getOpenvereLicense = ( license, licenseVersion, licenseUrl ) => {
let licenseName = license.trim();
// PDM has no abbreviation
if ( license !== 'pdm' ) {
licenseName = license.toUpperCase().replace( 'SAMPLING', 'Sampling' );
}
// If version is known, append version to the name.
// The license has to have a version to be valid. Only
// PDM (public domain mark) doesn't have a version.
if ( licenseVersion ) {
licenseName += ` ${ licenseVersion }`;
}
Expand Down Expand Up @@ -54,19 +52,18 @@ const getOpenvereLicense = (

const getOpenverseCaption = ( item ) => {
const {
/* translators: Openverse default media item title in the block inserter's media list. (ex. 'This work by {creator} is marked with CC0 1.0'). */
title = __( 'This work' ),
title,
foreign_landing_url: foreignLandingUrl,
creator,
creator_url: creatorUrl,
license,
license_version: licenseVersion,
license_url: licenseUrl,
} = item;
let _title = decodeEntities( title );
if ( !! foreignLandingUrl ) {
_title = getExternalLink( foreignLandingUrl, _title );
}
/* translators: Openverse default media item title in the block inserter's media list. (ex. 'This work by {creator} is marked with CC0 1.0'). */
const defaultTitle = __( 'This work' );
let _title = title ? decodeEntities( title ) : defaultTitle;
_title = getExternalLink( foreignLandingUrl, _title );
const fullLicense = getOpenvereLicense(
license,
licenseVersion,
Expand Down

1 comment on commit 95ad5f7

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3739210551
📝 Reported issues:

Please sign in to comment.