Skip to content

Feature: Optionally make embargo reason required#12067

Merged
stevenwinship merged 15 commits intoIQSS:developfrom
GlobalDataverseCommunityConsortium:DNO-make_embargo_reason_required
Feb 19, 2026
Merged

Feature: Optionally make embargo reason required#12067
stevenwinship merged 15 commits intoIQSS:developfrom
GlobalDataverseCommunityConsortium:DNO-make_embargo_reason_required

Conversation

@qqmyers
Copy link
Copy Markdown
Member

@qqmyers qqmyers commented Jan 3, 2026

What this PR does / why we need it: This PR adds a flag that, when set, makes it required to set the reason when creating an embargo, via the UI or API. In addition it adds a new check to assure that a supplied reason, whether required or not, is not blank.

Which issue(s) this PR closes:

Special notes for your reviewer:

Suggestions on how to test this:

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

Is there a release notes update needed for this change?:

Additional documentation:

@coveralls
Copy link
Copy Markdown

coveralls commented Jan 3, 2026

Coverage Status

coverage: 24.318% (+0.08%) from 24.235%
when pulling c82e961 on GlobalDataverseCommunityConsortium:DNO-make_embargo_reason_required
into ad8d686 on IQSS:develop.

@qqmyers qqmyers marked this pull request as ready for review January 3, 2026 21:01
@qqmyers qqmyers added the Size: 3 A percentage of a sprint. 2.1 hours. label Jan 5, 2026
@qqmyers qqmyers added this to the 6.10 milestone Jan 7, 2026
@cmbz cmbz added FY26 Sprint 14 FY26 Sprint 14 (2025-12-31 - 2026-01-14) and removed FY26 Sprint 14 FY26 Sprint 14 (2025-12-31 - 2026-01-14) labels Jan 14, 2026
@cmbz cmbz moved this to Ready for Review ⏩ in IQSS Dataverse Project Feb 11, 2026
@cmbz cmbz added the FY26 Sprint 17 FY26 Sprint 17 (2026-02-11 - 2026-02-25) label Feb 11, 2026
@sekmiller sekmiller moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Feb 13, 2026
@sekmiller sekmiller self-assigned this Feb 13, 2026
if(json.containsKey("reason")) {
reason = json.getString("reason");
}
if(reason == null && FeatureFlags.REQUIRE_EMBARGO_REASON.enabled()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor point, but would we want to check for blank ((null or blank) and flag) here when the reason is required to return the reason is required message?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The next check is for blank - just a slightly different error message.

} else if(reason != null && reason.isBlank()) {
return error(Status.BAD_REQUEST, "Reason cannot be blank (whitespace only)");
}
embargo.setReason(reason);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess it's out of scope for this, but did you consider using a command? (To do permission checks and even apply the FileUtil validation method.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For this PR I was just following the existing code, but yeah, that could have been done in a command. I'm not sure I understand about the FileUtil method - that seems pretty tied to JSF.

embargo.date.invalid=Date is outside the allowed range: ({0} to {1})
embargo.date.required=An embargo date is required
embargo.reason.required=An embargo reason is required
embargo.reason.blank=An embargo reason cannot be blank
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These could be used in the Datasets method

import static org.mockito.Mockito.when;

@LocalJvmSettings
public class DatasetsEmbargoAPITest {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I've been writing integration tests for my api endpoints and unit tests for commands. Beyond not having to deal with the database is there a reason for testing like this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

My understanding is you can't easily test FeatureFlags (or their non-default value) in IT tests since we don't have a way to change the flag remotely from the test. This style of test allows changing the flag value.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Right. I've run into issues with setting feature flags for integration tests. Thanks!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@github-project-automation github-project-automation Bot moved this from In Review 🔎 to Ready for QA ⏩ in IQSS Dataverse Project Feb 18, 2026
@sekmiller sekmiller removed their assignment Feb 18, 2026
@stevenwinship stevenwinship moved this from Ready for QA ⏩ to QA ✅ in IQSS Dataverse Project Feb 19, 2026
@stevenwinship stevenwinship self-assigned this Feb 19, 2026
@stevenwinship stevenwinship merged commit b95ee38 into IQSS:develop Feb 19, 2026
17 checks passed
@github-project-automation github-project-automation Bot moved this from QA ✅ to Merged 🚀 in IQSS Dataverse Project Feb 19, 2026
@stevenwinship stevenwinship removed their assignment Feb 19, 2026
@scolapasta scolapasta moved this from Merged 🚀 to Done 🧹 in IQSS Dataverse Project Feb 19, 2026
pdurbin added a commit that referenced this pull request Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY26 Sprint 17 FY26 Sprint 17 (2026-02-11 - 2026-02-25) GDCC: DataverseNO Size: 3 A percentage of a sprint. 2.1 hours.

Projects

Status: Done 🧹

Development

Successfully merging this pull request may close these issues.

Feature Request: Modifications to embargo function Set embargo date API results in internal server error

7 participants