Skip to content

ufal/dspace-angular#184 Read Terms of Service placeholder values from backend config - #188

Merged
kosarko merged 2 commits into
fix/tos-interpolation-184from
fix/tos-interpolation-184-backend-config
Oct 22, 2026
Merged

kosarko merged 2 commits into
fix/tos-interpolation-184from
fix/tos-interpolation-184-backend-config

Conversation

@kosarko

@kosarko kosarko commented Oct 21, 2026

Copy link
Copy Markdown
Member

Stacked on #185.

Problem description

#185 fills the Terms of Service placeholders from a new staticPage.variables UI config section, with LINDAT values as code defaults. Those are per-deployment details of the repository operator (legal entity, governing law, court), and the backend already holds them: dspace.name, plus description.institution / description.location, which OAI-PMH Identify uses. XMLUI also filled them from backend config (ufal/clarin-dspace#818). With UI defaults, a deployment that doesn't override them publishes binding terms naming LINDAT, Czech law and the Prague court, without any warning.

Analysis

  • Values come from /api/config/properties/{name}, the same way the UI already reads dspace.name, lr.help.mail and themed.by.*.
  • The staticPage config section is removed: the interface, the AppConfig field, the defaults, the config.json whitelist entry, the config.example.yml block and the mergeConfig test.
  • terms-of-service.html: placeholders renamed to the backend keys: ${description.institution}, ${description.location}, ${description.country}, ${description.city}. ${dspace.name} is unchanged.
  • StaticPageComponent.interpolateVariables():
    • It collects the distinct placeholder keys in the page and loads them in parallel. A page without placeholders makes no requests.
    • The backend splits a value on commas into several values; they are joined back with ", " (LINDAT's dspace.name comes back as 3 values).
    • Values are still HTML-escaped and inserted with a function replacer.
    • A property that is not exposed, not set, empty, or fails to load leaves ${key} in place and logs one warning. A failed request never turns the page into a 404.

Depends on

ufal/clarin-dspace#1424, which exposes the four description.* keys. Merge order does not matter: until it is deployed, the ${description.*} placeholders stay as they are today, and ${dspace.name} already resolves. Until then a deployment can expose the keys in local.cfg alone (see DSpace#1424).

Problems

  • A deployment must set description.country and description.city in the backend local.cfg. There is no default.
  • description.location is shared with OAI-PMH Identify. LINDAT's current value says "Prague"; the v5 ToS said "Praha".
  • Tests: static-page.component.spec.ts passes (30 tests); eslint on the changed files and yarn check-circ-deps pass. Not checked in a running app or SSR yet.

Copilot review

  • Requested review from Copilot

Fill the Terms of Service placeholders from /api/config/properties instead of
a new staticPage UI config section, as XMLUI did. Rename the placeholders to
the backend keys (description.*), join comma-split values with ", ", and
leave a placeholder as is when the property is missing or fails to load.
Requires ufal/clarin-dspace#1424.

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.

🟢 Approval recommended

No blocking issues were identified in backend lookup, fallback handling, escaping, or configuration cleanup.

No open issues 🎉

What changed in this PR

Moves Terms of Service placeholder values to backend configuration, removing deployment-specific frontend defaults.

Changes:

  • Loads distinct properties in parallel while preserving HTML escaping.
  • Leaves unresolved placeholders visible and warns without failing the page.
  • Removes obsolete UI configuration and updates unit tests.
File Description
src/​static-files/​terms-of-service.html Uses backend property names.
src/​config/​static-page-config.interface.ts Removes obsolete configuration class.
src/​config/​default-app-config.ts Removes deployment-specific defaults.
src/​config/​config.util.spec.ts Removes obsolete configuration merge test.
src/​config/​config.server.ts Removes static-page configuration export.
src/​config/​app-config.interface.ts Removes static-page configuration field.
src/​app/​static-page/​static-page.component.ts Loads and interpolates backend properties with fallback handling.
src/​app/​static-page/​static-page.component.spec.ts Tests backend lookup, escaping, and failure behavior.
config/​config.example.yml Removes obsolete placeholder configuration examples.

Review effort: Balanced

@kosarko
kosarko merged commit 550ec11 into clarin-v7 Oct 22, 2026
10 checks passed
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.

2 participants