Skip to content

VSB-TUO/CC licence section for the local CC legal tools CSV - #1714

Draft
xlukacm wants to merge 9 commits into
customer/vsb-tuofrom
vsb-tuo/cc-license-local-csv
Draft

xlukacm wants to merge 9 commits into
customer/vsb-tuofrom
vsb-tuo/cc-license-local-csv

Conversation

@xlukacm

@xlukacm xlukacm commented Nov 4, 2026

Copy link
Copy Markdown
Phases MP MM MB MR JM Total
ETA 0 0 0 0 0 0
Developing 0 0 0 0 0 0
Review 0 0 0 0 0 0
Total - - - - - 0
ETA est. 0
ETA cust. - - - - - 0

Problem description

Reported issues

The Creative Commons API (api.creativecommons.org) was shut down on 2026-11-02. The backend now serves the CC licences from a local CSV and sends i18n keys instead of localised texts, so the CC licence section has to translate them.

Not-reported issues

  • After a save or reopen, unticking the licence or choosing another option did not remove the stored dc.rights.uri (the REST API never returns accepted).

Analysis

Backport of the not-yet-merged upstream fix DSpace/dspace-angular#5735. The 3 upstream commits are cherry-picked with -x; the upstream template uses the new control-flow syntax, so the | translate change was applied to the VSB *ngIf template by hand, and the en.json5 keys of the PR head are appended in one commit.

VSB-TUO specifics:

Tested: submission-section-cc-licenses.component.spec.ts (21 tests, including untick/re-tick), type-check and lint, plus a local stack with the backend PR: new item, reopen restores the selection, Czech UI, and unticking the licence of an existing item with an http:// URI.

Requires the backend PR: dataquest-dev/DSpace#1645

Problems

  • The licence name in the dropdown ("Creative Commons License (4.0)") comes from the CSV and is not translated, as upstream.
  • The upstream PR is not merged yet; replace this backport with the merged version once it lands.

🤖 Generated with Claude Code

ConfusionOrb221 and others added 8 commits November 4, 2026 10:01
…pdown menu increase in size

(cherry picked from commit d21385b)
…is allows for adjusting the license based on what was previously provided between saves, fixed erroneous i18n message

(cherry picked from commit 20a50c1)
… translations for recombo

(cherry picked from commit 250d6ba)
The cherry-picked commits could not apply their en.json5 hunks onto the
customer file, so the final set of keys from the PR head
(7562344) is appended here in one go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The backend no longer localises the CC chooser (cc.license.locale is
gone), so the labels and hints now come from the UI translation files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The REST API never returns the accepted state, so after a save or reopen
this.data.accepted is undefined and the VSB guard (wasAccepted) never let
the remove through: unticking the licence, or picking another option, left
the old dc.rights.uri on the item. Take the upstream condition from
DSpace#5735 (250d6ba) and keep the VSB link filter on add.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It is an answer to 'Povolit úpravy vašeho díla?', so lead with 'Ano'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Unticking a saved licence queues a remove, but data.uri still holds the
stored link, so ticking it again was dropped by the #1009 duplicate-add
filter and the save removed the licence the UI showed as accepted. Let the
add through while a remove of the stored uri is pending.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

A critical race condition can delete a re-accepted license on save, and missing translations expose raw localization keys in several active languages.

2 open issues
What changed in this PR

This pull request updates the Creative Commons licence submission section for locally served CSV licence data, restores saved selections, translates licence metadata, and improves URI patch handling.

Changes:

  • Adds English and Czech translations for Creative Commons fields, options, descriptions, and hints.
  • Restores licence and option selections from saved Creative Commons URIs, including legacy HTTP and public-domain URLs.
  • Improves add/remove operation handling and expands component test coverage.
  • Updates the licence selector layout for responsive use.

Outstanding findings:

  • Critical (1 vote): Re-accepting an unticked licence can queue the add operation asynchronously, allowing a save to submit only the remove operation and permanently delete the licence. The stored URI must be queued synchronously or the save coordinated with the pending lookup.
  • Moderate (2 votes): CC translation keys are added only to the English and Czech catalogues; users of other active languages may see raw translation keys. Add the keys to each active catalogue or provide an explicit English fallback.
File Description
src/​assets/​i18n/​en.json5 Adds English Creative Commons licence translations.
src/​assets/​i18n/​cs.json5 Adds Czech Creative Commons licence translations.
src/​app/​submission/​sections/​cc-license/​submission-section-cc-licenses.component.ts Restores selections from saved URIs and manages translated metadata and URI patch operations.
src/​app/​submission/​sections/​cc-license/​submission-section-cc-licenses.component.spec.ts Tests URI restoration, option mapping, and add/remove state transitions.
src/​app/​submission/​sections/​cc-license/​submission-section-cc-licenses.component.scss Updates the licence selector sizing and responsive layout.
src/​app/​submission/​sections/​cc-license/​submission-section-cc-licenses.component.html Applies translations to licence labels, descriptions, hints, and options.

Review effort: Lite

Comment thread src/assets/i18n/en.json5 Resolved
When a saved licence is unticked and ticked again with the same selection,
add the stored uri synchronously instead of after the asynchronous link
lookup, so a save dispatched in between cannot send only the remove.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

An active moderate issue remains because an asynchronous URL lookup can use stale acceptance state and queue an add after the checkbox has been unticked.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Prevent stale lookup results from adding unchecked options

src/​app/​submission/​sections/​cc-license/​submission-section-cc-licenses.component.ts:339

This lookup subscription is not tied to the acceptance state that started it. For example, after a remove is queued, accepting a changed option starts an asynchronous URL lookup; unticking again before it completes leaves uriRemoveQueued true, so this predicate still accepts the stale result and queues an add even though the current checkbox is false. Cancel/invalidate the pending lookup when the selection or accepted state changes, or re-check the current state before adding the result.

1 resolved since last review

Review effort: Lite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants