Skip to content

Commit 510f118

Browse files
committed
- Fix: Do not send private data reminders for datasets that may have been resubmitted and are pending copy.
- Include experiment title in the private data reminder message - Updated PanoramaPublicMakePublicTest to verify that data pending copy cannot be made public by entering the MakePublicAction URL in the browser.
1 parent 108b842 commit 510f118

4 files changed

Lines changed: 117 additions & 18 deletions

File tree

panoramapublic/src/org/labkey/panoramapublic/PanoramaPublicController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6876,6 +6876,11 @@ private ExperimentAnnotations getCopiedExperimentFor(ExperimentAnnotations expAn
68766876
return null;
68776877
}
68786878

6879+
if (_journalSubmission.hasPendingSubmission())
6880+
{
6881+
errors.reject(ERROR_MSG, String.format("There is a pending re-submit request for this experiment on '%s'", _journal.getName()));
6882+
return null;
6883+
}
68796884
if (expAnnot.isJournalCopy())
68806885
{
68816886
if (!_journalSubmission.isLatestExperimentCopy(_expAnnot.getId()))
@@ -6894,11 +6899,6 @@ private ExperimentAnnotations getCopiedExperimentFor(ExperimentAnnotations expAn
68946899
errors.reject(ERROR_MSG, String.format("Cannot find a copy of experiment Id %d on '%s'", expAnnot.getId(), _journal.getName()));
68956900
return null;
68966901
}
6897-
if (submission.isPending())
6898-
{
6899-
errors.reject(ERROR_MSG, String.format("There is a pending re-submit request for experiment Id %d on '%s'", expAnnot.getId(), _journal.getName()));
6900-
return null;
6901-
}
69026902
return copiedExperiment;
69036903
}
69046904
}

panoramapublic/src/org/labkey/panoramapublic/PanoramaPublicNotification.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -396,14 +396,15 @@ public static String getDataStatusReminderMessage(@NotNull ExperimentAnnotations
396396
message.append("Dear ").append(getUserName(submitter)).append(",").append(NL2)
397397
.append("We are reaching out regarding your data on Panorama Public (").append(shortUrl).append("), which has been private since ")
398398
.append(dateString).append(".")
399-
.append("\n\n**Is the paper associated with this work already published?**")
400-
.append("\n- If yes: Please make your data public by clicking the \"Make Public\" button in your folder or by clicking this link: ")
399+
.append(NL2).append(bold("Title:")).append(" ").append(escape(exptAnnotations.getTitle()))
400+
.append(NL2).append(bold("Is the paper associated with this work already published?"))
401+
.append(NL).append("- If yes: Please make your data public by clicking the \"Make Public\" button in your folder or by clicking this link: ")
401402
.append(bold(link("Make Data Public", makePublicLink)))
402403
.append(". This helps ensure that your valuable research is easily accessible to the community.")
403-
.append("\n- If not: You have a couple of options:")
404-
.append("\n - **Request an Extension** - If your paper is still under review, or you need additional time, please let us know by clicking ")
404+
.append(NL).append("- If not: You have a couple of options:")
405+
.append(NL).append(" - ").append(bold("Request an Extension")).append(" - If your paper is still under review, or you need additional time, please let us know by clicking ")
405406
.append(bold(link("Request Extension", requestExtensionUrl.getURIString()))).append(".")
406-
.append("\n - **Delete from Panorama Public** - If you no longer wish to host your data on Panorama Public, please click ")
407+
.append(NL).append(" - ").append(bold("Delete from Panorama Public")).append(" - If you no longer wish to host your data on Panorama Public, please click ")
407408
.append(bold(link("Request Deletion", requesDeletionUrl.getURIString()))).append(". ")
408409
.append("We will remove your data from Panorama Public.");
409410
if (sourceExperiment != null)
@@ -413,9 +414,9 @@ public static String getDataStatusReminderMessage(@NotNull ExperimentAnnotations
413414
.append(") will remain intact, allowing you to resubmit your data in the future if you wish.");
414415
}
415416

416-
message.append("\n\nIf you have any questions or need further assistance, please do not hesitate to respond to this message by ")
417+
message.append(NL2).append("If you have any questions or need further assistance, please do not hesitate to respond to this message by ")
417418
.append(bold(link("clicking here", respondToMessageUrl.getURIString()))).append(".")
418-
.append("\n\nThank you for sharing your research on Panorama Public. We appreciate your commitment to open science and your contributions to the research community.")
419+
.append(NL2).append("Thank you for sharing your research on Panorama Public. We appreciate your commitment to open science and your contributions to the research community.")
419420
.append(NL2).append("Best regards,")
420421
.append(NL).append(getUserName(journalAdmin));
421422
return message.toString();

panoramapublic/test/src/org/labkey/test/components/panoramapublic/TargetedMsExperimentWebPart.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22

33
import org.labkey.test.BaseWebDriverTest;
44
import org.labkey.test.Locator;
5+
import org.labkey.test.WebTest;
6+
import org.labkey.test.WebTestHelper;
57
import org.labkey.test.components.BodyWebPart;
68
import org.labkey.test.util.DataRegionTable;
79
import org.openqa.selenium.WebElement;
810

11+
import java.net.MalformedURLException;
12+
import java.net.URL;
13+
import java.util.Map;
14+
915
import static org.junit.Assert.assertNotNull;
1016
import static org.junit.Assert.assertNull;
1117
import static org.junit.Assert.assertTrue;
@@ -83,6 +89,24 @@ public void clickMakePublic()
8389
clickLink(elementCache().makePublicButton, "Expected to see a \"Make Public\" button");
8490
}
8591

92+
public Integer getExperimentAnnotationsId()
93+
{
94+
WebElement moreDetailsLink = elementCache().moreDetailsLink;
95+
if (moreDetailsLink != null)
96+
{
97+
String href = moreDetailsLink.getAttribute("href");
98+
try
99+
{
100+
return Integer.parseInt(WebTestHelper.parseUrlQuery(new URL(href)).get("id"));
101+
}
102+
catch (MalformedURLException e)
103+
{
104+
throw new RuntimeException(e);
105+
}
106+
}
107+
return null;
108+
}
109+
86110
public void clickAddPublication()
87111
{
88112
clickLink(elementCache().addPublicationButton, "Expected to see a \"Add Publication\" button");

panoramapublic/test/src/org/labkey/test/tests/panoramapublic/PanoramaPublicMakePublicTest.java

Lines changed: 80 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
import org.openqa.selenium.NoSuchElementException;
1919
import org.openqa.selenium.WebElement;
2020

21+
import java.util.Map;
2122
import java.util.regex.Matcher;
2223
import java.util.regex.Pattern;
2324

2425
import static org.junit.Assert.assertEquals;
2526
import static org.junit.Assert.assertFalse;
27+
import static org.junit.Assert.assertNotNull;
2628
import static org.junit.Assert.assertTrue;
2729

2830
@Category({External.class, MacCossLabModules.class})
@@ -45,24 +47,38 @@ public void testExperimentCopy()
4547
verifyIsPublicColumn(PANORAMA_PUBLIC, experimentTitle, false);
4648
verifyPermissions(projectName, folderName, PANORAMA_PUBLIC, targetFolder);
4749

48-
// Verify that the submitter can make the data public
49-
verifyMakePublic(PANORAMA_PUBLIC, targetFolder, SUBMITTER, true);
5050
// Verify that a folder admin in the source folder, who is not the submitter or lab head will not see the
5151
// "Make Public" button in the Panorama Public copy.
52-
verifyMakePublic(PANORAMA_PUBLIC, targetFolder, ADMIN_2, false);
52+
verifyMakePublicButtonIsNotVisible(PANORAMA_PUBLIC, targetFolder, ADMIN_2,
53+
"Make Public button should not be visible to a non-submitter and non-lab head user in the Panorama Public copy");
54+
55+
// Verify that the submitter can make the data public
56+
verifyMakePublic(PANORAMA_PUBLIC, targetFolder, SUBMITTER, true);
5357

5458
// Resubmit the folder. This is still possible since the Panorama Public copy is not yet associated with a publication.
5559
resubmitFolder(projectName, folderName, SUBMITTER, true);
5660

61+
// Data copy is pending. Verify that the "Make Public" button in not available in the source folder or the copied folder
62+
verifyMakePublicButtonIsNotVisible(PANORAMA_PUBLIC, targetFolder, SUBMITTER,
63+
"Make Public button should not be visible in the Panorama Public copy for submitter if data copy is pending");
64+
verifyMakePublicButtonIsNotVisible(projectName, folderName, SUBMITTER,
65+
"Make Public button should not be visible in the Panorama Public copy for submitter if data copy is pending");
66+
67+
// Verify that the submitter cannot enter the MakePublicAction URL in the browser to make the data public
68+
verifyCannotMakePublicPendingResubmit(PANORAMA_PUBLIC, targetFolder, SUBMITTER); // In the target folder
69+
verifyCannotMakePublicPendingResubmit(projectName, folderName, SUBMITTER); // In the source folder
70+
5771
// Re-copy the experiment to the Panorama Public project. Do not delete the previous copy
5872
makeCopy(shortAccessUrl, experimentTitle, targetFolder, true, false);
5973

6074
// Verify that the "Make Public button is not visible in the older copy of the data.
6175
String v1Folder = targetFolder + " V.1";
62-
verifyMakePublic(PANORAMA_PUBLIC, v1Folder, SUBMITTER, true);
63-
// Verify that the submitter can make data public, and add publication details
76+
verifyMakePublicButtonIsNotVisible(PANORAMA_PUBLIC, v1Folder, SUBMITTER,
77+
"Make Public button should not be visible in an older copy of the data");
78+
verifyCannotMakePublicOldCopy(PANORAMA_PUBLIC, v1Folder, SUBMITTER);
79+
80+
// Verify that the submitter can make the latest copy of the data public, and add publication details
6481
verifyMakePublic(PANORAMA_PUBLIC, targetFolder, SUBMITTER, true, true);
65-
verifyMakePublic(PANORAMA_PUBLIC, v1Folder, ADMIN_2, false);
6682

6783
verifyIsPublicColumn(PANORAMA_PUBLIC, experimentTitle, true);
6884

@@ -281,6 +297,64 @@ private void verifyMakePublic(String projectName, String folderName, String user
281297
stopImpersonating();
282298
}
283299

300+
private void verifyMakePublicButtonVisible(boolean visible, String projectName, String folderName, String user, String errorMessage)
301+
{
302+
if (isImpersonating())
303+
{
304+
stopImpersonating(true);
305+
}
306+
goToProjectFolder(projectName, folderName);
307+
impersonate(user);
308+
goToDashboard();
309+
TargetedMsExperimentWebPart expWebPart = new TargetedMsExperimentWebPart(this);
310+
311+
if (visible)
312+
{
313+
assertTrue(errorMessage, expWebPart.hasMakePublicButton());
314+
}
315+
else
316+
{
317+
assertFalse(errorMessage, expWebPart.hasMakePublicButton());
318+
}
319+
}
320+
321+
private void verifyMakePublicButtonIsVisible(String projectName, String folderName, String user, String errorMessage)
322+
{
323+
verifyMakePublicButtonVisible(true, projectName, folderName, user, errorMessage);
324+
}
325+
326+
private void verifyMakePublicButtonIsNotVisible(String projectName, String folderName, String user, String errorMessage)
327+
{
328+
verifyMakePublicButtonVisible(false, projectName, folderName, user, errorMessage);
329+
}
330+
331+
private void verifyCannotMakePublicOldCopy(String projectName, String folderName, String user)
332+
{
333+
verifyCannotMakePublic(projectName, folderName, user, "not the most recent copy of the data");
334+
}
335+
336+
private void verifyCannotMakePublicPendingResubmit(String projectName, String folderName, String user)
337+
{
338+
verifyCannotMakePublic(projectName, folderName, user, "There is a pending re-submit request for this experiment");
339+
}
340+
341+
private void verifyCannotMakePublic(String projectName, String folderName, String user, String expectedMessage)
342+
{
343+
if (isImpersonating())
344+
{
345+
stopImpersonating(true);
346+
}
347+
goToProjectFolder(projectName, folderName);
348+
impersonate(user);
349+
goToDashboard();
350+
TargetedMsExperimentWebPart expWebPart = new TargetedMsExperimentWebPart(this);
351+
Integer expAnnotationsId = expWebPart.getExperimentAnnotationsId();
352+
assertNotNull(expAnnotationsId);
353+
beginAt(WebTestHelper.buildURL("panoramapublic", getCurrentContainerPath(), "makePublic", Map.of("id", expAnnotationsId)));
354+
waitForText(expectedMessage);
355+
}
356+
357+
284358
private void makeDataPublic()
285359
{
286360
makeDataPublic(true);

0 commit comments

Comments
 (0)