Skip to content

Commit

Permalink
send notices based on feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
qqmyers committed Feb 15, 2025
1 parent af202df commit d8f18e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/sphinx-guides/source/installation/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3146,6 +3146,7 @@ dataverse.ui.show-curation-status-to-all
++++++++++++++++++++++++++++++++++++++++

By default the curation status assigned to a draft dataset versioncan only be seen by those who can publish it. When this flag is true, anyone who can see the draft dataset can see the assigned status.
These users will also get notifications/emails about changes to the status.
See :ref:`:AllowedCurationLabels <:AllowedCurationLabels>` and the :doc:`/admin/dataverses-datasets` section for more information about curation status.

Defaults to ``false``.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import edu.harvard.iq.dataverse.engine.command.RequiredPermissions;
import edu.harvard.iq.dataverse.engine.command.exception.CommandException;
import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException;
import edu.harvard.iq.dataverse.settings.JvmSettings;
import edu.harvard.iq.dataverse.settings.SettingsServiceBean;
import edu.harvard.iq.dataverse.util.BundleUtil;
import edu.harvard.iq.dataverse.util.SystemConfig;
Expand Down Expand Up @@ -104,7 +105,14 @@ public Dataset save(CommandContext ctxt) throws CommandException {

AuthenticatedUser requestor = getUser().isAuthenticated() ? (AuthenticatedUser) getUser() : null;

List<AuthenticatedUser> authUsers = ctxt.permissions().getUsersWithPermissionOn(Permission.PublishDataset, savedDataset);
boolean showToAll = JvmSettings.UI_SHOW_CURATION_STATUS_TO_ALL.lookupOptional(Boolean.class).orElse(false);

List<AuthenticatedUser> authUsers;
if (showToAll) {
authUsers = ctxt.permissions().getUsersWithPermissionOn(Permission.ViewUnpublishedDataset, savedDataset);
} else {
authUsers = ctxt.permissions().getUsersWithPermissionOn(Permission.PublishDataset, savedDataset);
}
for (AuthenticatedUser au : authUsers) {
ctxt.notifications().sendNotification(au, new Timestamp(new Date().getTime()), UserNotification.Type.STATUSUPDATED, savedDataset.getLatestVersion().getId(), "", requestor, false);
}
Expand Down

0 comments on commit d8f18e4

Please sign in to comment.