diff --git a/src/components/admin/LicenceInput.tsx b/src/components/admin/LicenceInput.tsx index ff4727267..bd3c7aa1f 100644 --- a/src/components/admin/LicenceInput.tsx +++ b/src/components/admin/LicenceInput.tsx @@ -39,6 +39,18 @@ function offerOf(rights: string, defaultLicence: string) { return found ? { id: found, name: nameOf(found) } : { id: defaultLicence, name: licenceShortName(defaultLicence) ?? "the default" }; } +/** + * The licence a record's rights name, when its own says otherwise: rights edited to "All rights reserved" after it started + * with CC BY 4.0. A licence of the record's own goes against rights that name one of Zenodo's, or that keep every right + * while it is open; a closed one of its own under "All rights reserved" agrees with them. + */ +function contradicted(licence: RecordLicence | null, rights: string) { + const found = licenceFromRights(rights); + if (!licence || !found) return null; + if (licence.kind === "zenodo") return found === licence.id ? null : { found, own: nameOf(licence.id) }; + return licenceComplete(licence) && (found !== "other-closed" || licence.open) ? { found, own: licence.title } : null; +} + /** * Where the licence came from, said under the field: its rights, the community's default, or a person. "Its rights" * never says "above": the import review has no Rights field to point at. @@ -52,6 +64,12 @@ function originNote(licence: RecordLicence | null, rights: string, defaultLicenc return "Chosen for this record."; } +/** The note under the field: the licence its rights name when it has another, or else where its licence came from. */ +function noteOf(licence: RecordLicence | null, rights: string, defaultLicence: string) { + const other = contradicted(licence, rights); + return other ? `Its rights name ${nameOf(other.found)}, not ${other.own}.` : originNote(licence, rights, defaultLicence); +} + /** * A record's licence: one of Zenodo's, or another by its name and link. It is what Zenodo and Crossref get for the * record's DOI, so a record with none can't get one. Shaped like the Study type field: the search, then where the @@ -130,10 +148,10 @@ export function LicenceInput({

- {originNote(licence, rights, defaultLicence)} + {noteOf(licence, rights, defaultLicence)} {missing ? " A DOI needs one." : null}

- {!licenceComplete(licence) && !disabled ? ( + {(!licenceComplete(licence) || contradicted(licence, rights)) && !disabled ? ( // A licence without a short name, such as CC BY-NC-ND 3.0 IGO, goes by its full title, which the note above names // whole: the button keeps to half the row and cuts it.