DT-2963: Add data location URL to emails that go to Researchers#2830
Merged
DT-2963: Add data location URL to emails that go to Researchers#2830
Conversation
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a dataset “data location URL” into the dataset model used for researcher approval emails, enabling the researcher-facing templates to display a per-dataset location link when available.
Changes:
- Extend
DatasetMailDTOto includedataLocationUrland populate it from dataset properties inVoteService. - Update researcher email templates to render the dataset location column and migrate those templates from
.htmlto.ftl. - Refactor
VoteServiceconstruction to useDAOContainerand update affected tests accordingly.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/org/broadinstitute/consent/http/service/VoteService.java | Populates dataLocationUrl on DatasetMailDTO from dataset properties; constructor now takes DAOContainer. |
| src/main/java/org/broadinstitute/consent/http/models/dto/DatasetMailDTO.java | Converts DTO to a record and adds dataLocationUrl field. |
| src/main/java/org/broadinstitute/consent/http/enumeration/EmailType.java | Switches researcher-approved email templates to .ftl filenames. |
| src/main/java/org/broadinstitute/consent/http/ConsentModule.java | Updates Guice provider wiring for the new VoteService constructor. |
| src/main/resources/freemarker/researcher-dar-approved.ftl | Adds “Dataset Location” column and conditional link rendering. |
| src/main/resources/freemarker/researcher-progress-report-approved.ftl | Adds “Dataset Location” column and conditional link rendering. |
| src/test/java/org/broadinstitute/consent/http/service/VoteServiceTest.java | Updates VoteService construction to use DAOContainer; adds tests; updates RADAR notification assertions. |
| src/test/java/org/broadinstitute/consent/http/service/EmailServiceTest.java | Updates DTO construction + minor list accessor change. |
| src/test/java/org/broadinstitute/consent/http/mail/message/ResearcherDarApprovedMessageTest.java | Updates tests to include dataLocationUrl expectations. |
| src/test/java/org/broadinstitute/consent/http/mail/message/ResearcherProgressReportApprovedMessageTest.java | Updates tests to include dataLocationUrl expectations. |
| src/test/java/org/broadinstitute/consent/http/mail/message/DataCustodianApprovalMessageTest.java | Updates DTO construction to new record signature. |
| src/test/java/org/broadinstitute/consent/http/mail/message/DACMembersDARRADARApprovedMessageTest.java | Updates DTO construction to new record signature. |
Comments suppressed due to low confidence (3)
src/main/resources/freemarker/researcher-dar-approved.ftl:51
dataset.dataLocationUrlis interpolated directly into both the link text and thehrefattribute without escaping/encoding, and FreeMarker auto-escaping is not enabled inFreeMarkerTemplateHelper. This can allow HTML attribute/text injection if the stored URL contains quotes/markup. Use FreeMarker escaping (e.g., HTML-escape the attribute/text and/or URL-encode), and consider checking?has_contentinstead of only??to avoid rendering empty links.
src/main/resources/freemarker/researcher-progress-report-approved.ftl:51dataset.dataLocationUrlis inserted into the link text andhrefattribute without escaping/encoding, and FreeMarker auto-escaping is not enabled in this codebase. If the dataset property contains quotes/markup, it can break the attribute context and inject HTML into the email. Escape/encode the value in the template (and consider?has_contentinstead of only??so empty strings don’t create empty anchors).
src/test/java/org/broadinstitute/consent/http/service/VoteServiceTest.java:1195- In this test setup,
dataset2is created but the subsequent setters are applied todataset1(e.g.,dataset1.setDatasetId(2),dataset1.setAlias(2), etc.). This leavesdataset2uninitialized (null ids / dacId), which will cause incorrect stubbing/verification and can make the test fail or pass for the wrong reason. Update the setters to initializedataset2instead of overwritingdataset1.
new Date())));
Dataset dataset2 = new Dataset();
dataset1.setDatasetId(2);
dataset1.setAlias(2);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
kevinmarete
approved these changes
Mar 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Addresses
https://broadworkbench.atlassian.net/browse/DT-2963
Summary
This adds the
dataLocationUrldataset property (if it exists) to the underlyingDatasetMailDTOobject that populates emails. This model is used in email sent to the following users in the following conditions:However, we are only modifying the emails that go out to researchers. The DAC and Data Custodian emails are not modified, but could be if needed in the future.
Drive-by improvements:
VoteServiceto use aDAOContainerto populate DAO classes instead of directly injecting them one-by-one.DatasetMailDTOto a record class.Example Email
Have you read CONTRIBUTING.md lately? If not, do that first.