Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASSETS-88890 : Hide "Edit in Express" icon for Licensed Content #45

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions blocks/adp-asset-details-modal/adp-asset-details-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { closeModal } from '../../scripts/shared.js';
import { authorizeURL, getAssetMetadata } from '../../scripts/polaris.js';
import {
getAssetName, getAssetMimeType, getAssetTitle,
getAssetName, getAssetMimeType, getAssetTitle, isLicensedContent,
} from '../../scripts/metadata.js';
// eslint-disable-next-line import/no-cycle
import { disableActionButtons } from '../adp-asset-details-panel/adp-asset-details-panel.js';
Expand Down Expand Up @@ -96,7 +96,8 @@
// ensure express button only shows for valid asset types
const expressBtn = modal.querySelector('.action-edit-asset');
const validCheck = fileValidity(format);
if (isCCEConfigured() && validCheck.isValid) {
if (isCCEConfigured() && validCheck.isValid && !isLicensedContent(assetJSON)) {
//Only show express button for content that is not licensed.

Check failure on line 100 in blocks/adp-asset-details-modal/adp-asset-details-modal.js

View workflow job for this annotation

GitHub Actions / build

Expected exception block, space or tab after '//' in comment
expressBtn.classList.remove('hidden');
} else if (!expressBtn.classList.contains('hidden')) {
expressBtn.classList.add('hidden');
Expand Down
5 changes: 3 additions & 2 deletions blocks/adp-asset-details-panel/adp-asset-details-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { openAssetDetailsModal } from '../adp-asset-details-modal/adp-asset-details-modal.js';
import { fetchMetadataAndCreateHTML } from '../../scripts/metadata-html-builder.js';
import {
getAssetMimeType, getAssetTitle, getAssetName, getAssetHeight, getAssetWidth,
getAssetMimeType, getAssetTitle, getAssetName, getAssetHeight, getAssetWidth, isLicensedContent,
} from '../../scripts/metadata.js';
import {
getAssetMetadata,
Expand Down Expand Up @@ -74,7 +74,8 @@
// ensure express button only shows for valid asset types
const expressBtn = assetDetailsPanel.querySelector('.action-edit-asset');
const validCheck = fileValidity(fileFormat);
if (isCCEConfigured() && validCheck.isValid) {
if (isCCEConfigured() && validCheck.isValid && !isLicensedContent(assetJSON)) {
//Only show express button for content that is not licensed.

Check failure on line 78 in blocks/adp-asset-details-panel/adp-asset-details-panel.js

View workflow job for this annotation

GitHub Actions / build

Expected exception block, space or tab after '//' in comment
expressBtn.classList.remove('hidden');
} else if (!expressBtn.classList.contains('hidden')) {
expressBtn.classList.add('hidden');
Expand Down
8 changes: 8 additions & 0 deletions scripts/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ export function getAssetSize(assetJSON) {
return getMetadataValue('size', assetJSON);
}

/**
* Is licensed content
* Returns true for gmo:licensedContent != 'no'
*/
export function isLicensedContent(assetJSON) {
return getMetadataValue('gmo:licensedContent', assetJSON) !== 'no';
}

/**
* Predefined metadata fields that have special handling, can have compound values and a
* special formatter.
Expand Down
Loading