From 5a53fa0f42b88b614685ebfd72ad47428f1c2028 Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Wed, 18 Oct 2017 12:32:47 -0400 Subject: [PATCH] get ReturnDatasetToAuthorCommandTest passing #4124 #4139 The relationship between locks and users is confusing. I left a TODO. --- .../engine/command/impl/ReturnDatasetToAuthorCommand.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ReturnDatasetToAuthorCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ReturnDatasetToAuthorCommand.java index 81399a57190..fc5272dc406 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ReturnDatasetToAuthorCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ReturnDatasetToAuthorCommand.java @@ -17,7 +17,6 @@ import java.sql.Timestamp; import java.util.Date; import java.util.List; -import java.util.Set; import java.util.concurrent.Future; @RequiredPermissions(Permission.PublishDataset) @@ -63,16 +62,12 @@ public Dataset save(CommandContext ctxt) throws CommandException { for (DatasetLock lock : theDataset.getLocks()) { if (DatasetLock.Reason.InReview.equals(lock.getReason())) { theDataset.removeLock(lock); + // TODO: Are we supposed to remove the dataset lock from the user? What's going on here? authenticatedUser = lock.getUser(); - authenticatedUser.getDatasetLocks().remove(lock); } } Dataset savedDataset = ctxt.em().merge(theDataset); ctxt.em().flush(); - if (authenticatedUser != null) { - // Remove lock from user. - ctxt.em().merge(authenticatedUser); - } DatasetVersionUser ddu = ctxt.datasets().getDatasetVersionUser(theDataset.getLatestVersion(), this.getUser());