Skip to content

Commit a787dfe

Browse files
committed
FIX: License compatibility check should be based on the link type between the glose and the source.
1 parent 8552aee commit a787dfe

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

frontend/src/components/LicenseCompatibility.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ const licenseCompatibility = {
99
'All rights reserved': ['All rights reserved'],
1010
};
1111

12-
function LicenseCompatibility({ sourceMetadata, marginLicense }) {
13-
const sourceLicense = sourceMetadata?.dc_license;
14-
const isAdaptation = sourceMetadata?.links?.some(x => x.verb === 'adapts');
12+
function LicenseCompatibility({ sourceMetadata, marginMetadata }) {
13+
const isAdaptation = marginMetadata?.links?.some(x => x.verb === 'adapts');
14+
1515
const getLicenseKey = (licenseUri) => {
1616
if (!licenseUri) return 'All rights reserved';
1717
if (licenseUri.toLowerCase() === 'public domain') return 'Public domain';
1818
const matches = /BY[\w-]*/i.exec(licenseUri);
1919
return matches ? matches[0].toLowerCase() : 'All rights reserved';
2020
};
2121

22-
const sourceKey = getLicenseKey(sourceLicense);
23-
const marginKey = getLicenseKey(marginLicense);
22+
const sourceKey = getLicenseKey(sourceMetadata?.dc_license);
23+
const marginKey = getLicenseKey(marginMetadata?.dc_license);
2424
const isCompatible = isAdaptation ? licenseCompatibility[sourceKey]?.includes(marginKey) : true;
2525

2626
const warningStyle = {

frontend/src/components/OpenedDocuments.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function OpenedDocuments({id, margin, metadata, parallelDocuments, rawEditMode,
5050
{margin && (
5151
<Row>
5252
<Col>
53-
<LicenseCompatibility {...{sourceMetadata, marginLicense}} />
53+
<LicenseCompatibility {...{sourceMetadata, marginMetadata}} />
5454
</Col>
5555
</Row>
5656
)}

0 commit comments

Comments
 (0)