Skip to content

feat!(website): Allow customization of data use terms agreement text#6149

Merged
theosanderson merged 8 commits intomainfrom
claude/data-use-terms-agreement-de4yC
Apr 15, 2026
Merged

feat!(website): Allow customization of data use terms agreement text#6149
theosanderson merged 8 commits intomainfrom
claude/data-use-terms-agreement-de4yC

Conversation

@theosanderson
Copy link
Copy Markdown
Member

@theosanderson theosanderson commented Mar 17, 2026

The purpose of this is to allow linking to for example the "how to cite" page in addition

Description

This PR adds support for customizing the data use terms agreement checkbox label text in the download dialog through configuration. Previously, the text was hardcoded as "I agree to the data use terms" with a link to the terms page.

The changes allow administrators to provide custom HTML for the agreement label via the dataUseTerms.agreementHtml configuration option, enabling more flexible messaging while maintaining backward compatibility with a sensible default.

Changes

  • Added optional dataUseTermsAgreementHtml configuration property to website config schema
  • Updated DownloadDialog component to use custom HTML when provided, falling back to the default text
  • Added configuration getter getDataUseTermsAgreementHtml() to retrieve the custom HTML
  • Updated Kubernetes Helm templates to support the new configuration option
  • Threaded the new prop through the component hierarchy (SearchFullUIDownloadDialog)
  • Updated test utilities to support the new prop

Configuration

The new configuration option is optional and located under dataUseTerms.agreementHtml. When not provided, the component renders the default agreement text. The configuration accepts HTML strings, allowing for custom links and formatting.

PR Checklist

  • All necessary documentation has been adapted (schema, values.yaml, types)
  • The implemented feature is covered by appropriate, automated tests (test helper updated)
  • Manual testing: Verified component renders with and without custom HTML, and that default fallback works correctly

https://claude.ai/code/session_013oJyL4K1RSVkBKLpEBa3DC

🚀 Preview: Add preview label to enable

claude added 2 commits March 17, 2026 15:17
… values.yaml

Add a `dataUseTerms.agreementHtml` setting in values.yaml that allows
overriding the "I agree to the data use terms." checkbox label in the
download dialog with custom HTML. This enables linking to multiple
different pages or customizing the agreement text per instance.

The default value preserves the current behavior with a link to the
data use terms page.

https://claude.ai/code/session_013oJyL4K1RSVkBKLpEBa3DC
@claude claude bot added website Tasks related to the web application deployment Code changes targetting the deployment infrastructure labels Mar 17, 2026
@claude
Copy link
Copy Markdown
Contributor

claude bot commented Mar 17, 2026

This PR may be related to: #3674 (Genericise data use terms for other maintainers)

claude and others added 4 commits March 17, 2026 15:21
… error in DownloadDialog

The agreementHtml property was placed outside the properties object in
the dataUseTerms schema definition, causing invalid JSON. Also add
eslint-disable for the __html key required by dangerouslySetInnerHTML.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove the agreementHtml setting from values.yaml so the fallback is
used, and simplify the fallback text to plain "I agree to the data use
terms." without a link.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@theosanderson theosanderson marked this pull request as ready for review April 13, 2026 09:04
@claude
Copy link
Copy Markdown
Contributor

claude bot commented Apr 13, 2026

Claude finished @theosanderson's task in 1m 13s —— View job


Code Review

  • Gather context and read changed files
  • Review security (XSS concerns with custom HTML)
  • Review code quality and implementation
  • Review testing coverage
  • Post final review

Overall the implementation is clean and follows existing patterns in the codebase. There are a few issues to address.

Default text regression (important)

DownloadDialog.tsx:149 — The fallback text 'I agree to the data use terms.' has lost the link to the data use terms page that previously existed. The old code rendered:

I agree to the <a href={routes.datauseTermsPage()}>data use terms</a>.

The new default omits the link entirely. Anyone not supplying a custom agreementHtml will now see unlinked text. The default should either include the link (as inline HTML) or be restored to the original JSX path when dataUseTermsAgreementHtml is undefined.

Fix this →

XSS / dangerouslySetInnerHTML

DownloadDialog.tsx:145-151 — The raw config value is injected directly without sanitization. The Banner.tsx component does the same, so this is consistent with an existing pattern, but it's worth noting: if an attacker can tamper with Helm values (e.g. through a compromised CI or values file), they could inject arbitrary scripts into the download dialog. The project already has sanitize-html installed (used in DataTableEntryValue.tsx). Consider wrapping the value with it, or at minimum documenting in the schema that this is trusted-admin-only HTML and never derived from user input.

Helm template whitespace

_common-metadata.tpl:219 — The opening {{ if ... }} doesn't strip the preceding newline, unlike the {{- end }} below it. This will emit a blank line in the ConfigMap data when agreementHtml is not set (harmless but inconsistent with the style of the rest of the file). Change to {{- if $.Values.dataUseTerms.agreementHtml }}.

Fix this →

Missing test coverage

DownloadDialog.spec.tsx — The test helper was updated to accept dataUseTermsAgreementHtml but no new test cases exercise it. Consider adding:

  • A test that confirms custom HTML is rendered when the prop is provided.
  • A test that confirms the default text (including the link) is rendered when the prop is absent.

@theosanderson theosanderson changed the title Allow customization of data use terms agreement text feat!(website): Allow customization of data use terms agreement text Apr 13, 2026
Copy link
Copy Markdown
Collaborator

@tombch tombch left a comment

Choose a reason for hiding this comment

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

Image

Tested with a custom HTML link and it looks good! My only (tiny) thought was if the agreementHtml should be agreementHTML in the config, in line with the other config variables like welcomeMessageHTML, but not blocking!

@theosanderson
Copy link
Copy Markdown
Member Author

@theosanderson-agent make the casing change to agreementHTML

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@theosanderson-agent
Copy link
Copy Markdown
Collaborator

Renamed agreementHtmlagreementHTML across all 8 files (Helm values schema, template, website config, types, components, and tests). Type checks, tests (31/31), helm lint all pass.

Copy link
Copy Markdown
Collaborator

@tombch tombch left a comment

Choose a reason for hiding this comment

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

Tested again with agreementHTML and looks good!

@theosanderson
Copy link
Copy Markdown
Member Author

Thanks for testing again!!

@theosanderson
Copy link
Copy Markdown
Member Author

I'm just waiting to merge til I have time to prepare a corresponding change to PPX

@theosanderson theosanderson merged commit f47de27 into main Apr 15, 2026
46 checks passed
@theosanderson theosanderson deleted the claude/data-use-terms-agreement-de4yC branch April 15, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deployment Code changes targetting the deployment infrastructure website Tasks related to the web application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants