Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6876,6 +6876,11 @@ private ExperimentAnnotations getCopiedExperimentFor(ExperimentAnnotations expAn
return null;
}

if (_journalSubmission.hasPendingSubmission())
{
errors.reject(ERROR_MSG, String.format("There is a pending re-submit request for this experiment on '%s'", _journal.getName()));
return null;
}
if (expAnnot.isJournalCopy())
{
if (!_journalSubmission.isLatestExperimentCopy(_expAnnot.getId()))
Expand Down Expand Up @@ -7007,12 +7012,10 @@ public void validateCommand(PublicationDetailsForm form, Errors errors)
return;
}
}
if (!form.hasNewPublicationDetails(_copiedExperiment))
{
errors.reject(ERROR_MSG, String.format("Publication details are the same as the ones associated with the data on %s at %s",
_journal.getName(), _copiedExperiment.getShortUrl().renderShortURL()));
return;
}
// Validation removed: no need to ensure that publication details entered in the form differ from the
// publication details already associated with the experiment. The user may have entered the
// correct PubMedID etc. when submitting but forgot to make the data public.
// (See commit history for the original logic.)
}
else if (_copiedExperiment.isPublic())
{
Expand Down Expand Up @@ -7356,13 +7359,6 @@ public boolean hasLinkAndCitation()
{
return !(StringUtils.isBlank(_link) || StringUtils.isBlank(_citation));
}

public boolean hasNewPublicationDetails(ExperimentAnnotations copiedExperiment)
{
return !(Objects.equals(_pubmedId, copiedExperiment.getPubmedId())
&& Objects.equals(_link, copiedExperiment.getPublicationLink())
&& Objects.equals(_citation, copiedExperiment.getCitation()));
}
}

public static abstract class PanoramaPublicExperimentAction<T extends ExperimentIdForm> extends FormViewAction<T>
Expand Down Expand Up @@ -9849,7 +9845,7 @@ private MessageExampleBean createExampleMessage(List<Integer> experimentIds, Pan
{
continue;
}
Announcement announcement = announcementSvc.getAnnouncement(announcementsContainer, getUser(), submission.getAnnouncementId());
Announcement announcement = submission.getAnnouncement(announcementSvc, announcementsContainer, getUser());
if (announcement == null)
{
continue; // old data before we started posting submission requests to a message board
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,14 +396,15 @@ public static String getDataStatusReminderMessage(@NotNull ExperimentAnnotations
message.append("Dear ").append(getUserName(submitter)).append(",").append(NL2)
.append("We are reaching out regarding your data on Panorama Public (").append(shortUrl).append("), which has been private since ")
.append(dateString).append(".")
.append("\n\n**Is the paper associated with this work already published?**")
.append("\n- If yes: Please make your data public by clicking the \"Make Public\" button in your folder or by clicking this link: ")
.append(NL2).append(bold("Title:")).append(" ").append(escape(exptAnnotations.getTitle()))
.append(NL2).append(bold("Is the paper associated with this work already published?"))
.append(NL).append("- If yes: Please make your data public by clicking the \"Make Public\" button in your folder or by clicking this link: ")
.append(bold(link("Make Data Public", makePublicLink)))
.append(". This helps ensure that your valuable research is easily accessible to the community.")
.append("\n- If not: You have a couple of options:")
.append("\n - **Request an Extension** - If your paper is still under review, or you need additional time, please let us know by clicking ")
.append(NL).append("- If not: You have a couple of options:")
.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 ")
.append(bold(link("Request Extension", requestExtensionUrl.getURIString()))).append(".")
.append("\n - **Delete from Panorama Public** - If you no longer wish to host your data on Panorama Public, please click ")
.append(NL).append(" - ").append(bold("Delete from Panorama Public")).append(" - If you no longer wish to host your data on Panorama Public, please click ")
.append(bold(link("Request Deletion", requesDeletionUrl.getURIString()))).append(". ")
.append("We will remove your data from Panorama Public.");
if (sourceExperiment != null)
Expand All @@ -413,9 +414,9 @@ public static String getDataStatusReminderMessage(@NotNull ExperimentAnnotations
.append(") will remain intact, allowing you to resubmit your data in the future if you wish.");
}

message.append("\n\nIf you have any questions or need further assistance, please do not hesitate to respond to this message by ")
message.append(NL2).append("If you have any questions or need further assistance, please do not hesitate to respond to this message by ")
.append(bold(link("clicking here", respondToMessageUrl.getURIString()))).append(".")
.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.")
.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.")
.append(NL2).append("Best regards,")
.append(NL).append(getUserName(journalAdmin));
return message.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ public List<String> getInstruments()
return instruments;
}

public String getInstrumentsCommaSeparated()
{
return StringUtils.join(getInstruments(), ", ");
}

public void setInstrument(String instrument)
{
_instrument = instrument;
Expand Down Expand Up @@ -504,12 +509,12 @@ public DataLicense getDataLicense()

/**
* Returns true if the experiment is in an 'Experimental Data' folder that is public and the experiment is
* associated with a published paper.
* associated with a peer-reviewed paper (excludes biorxiv and medrxiv preprint servers).
*/
public boolean isFinal()
{
TargetedMSService.FolderType folderType = TargetedMSService.get().getFolderType(getContainer());
return Experiment.equals(folderType) && isPublic() && isPublished();
return Experiment.equals(folderType) && isPublic() && isPeerReviewed();
}

public boolean hasCompletePublicationInfo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.labkey.api.announcements.api.Announcement;
import org.labkey.api.announcements.api.AnnouncementService;
import org.labkey.api.data.Container;
import org.labkey.api.security.User;
import org.labkey.api.view.ShortURLRecord;
import org.labkey.panoramapublic.query.SubmissionManager;

Expand Down Expand Up @@ -69,11 +73,20 @@ public int getModifiedBy()
return _journalExperiment.getModifiedBy();
}

public Integer getAnnouncementId()
public @Nullable Integer getAnnouncementId()
{
return _journalExperiment.getAnnouncementId();
}

public @Nullable Announcement getAnnouncement(@NotNull AnnouncementService announcementSvc,
@NotNull Container announcementsContainer,
@NotNull User user)
{
return (getAnnouncementId() != null)
? announcementSvc.getAnnouncement(announcementsContainer, user, getAnnouncementId())
: null; // old data before we started posting submission requests to a message board
}

public Integer getReviewerId()
{
return _journalExperiment.getReviewer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ private void postMessage()
continue;
}

Announcement announcement = announcementSvc.getAnnouncement(announcementsContainer, getUser(), submission.getAnnouncementId());
Announcement announcement = submission.getAnnouncement(announcementSvc, announcementsContainer, getUser());

if (announcement == null)
{
getLogger().error("Could not find the message thread for experiment Id: " + experimentAnnotationsId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ private static ReminderDecision getReminderDecision(@NotNull ExperimentAnnotatio
return ReminderDecision.skip("Not the current version of the experiment");
}

// Make sure the data does not have a pending re-submission request
JournalSubmission journalSubmission = SubmissionManager.getSubmissionForJournalCopy(exptAnnotations);
if (journalSubmission != null && journalSubmission.hasPendingSubmission())
{
return ReminderDecision.skip("Data has a pending re-submission request");
}

DatasetStatus datasetStatus = DatasetStatusManager.getForExperiment(exptAnnotations);
if (datasetStatus != null)
{
Expand Down Expand Up @@ -244,7 +251,7 @@ private void processExperiment(Integer experimentAnnotationsId, ProcessingContex
}

Container announcementsFolder = context.getAnnouncementsFolder();
Announcement announcement = context.getAnnouncementService().getAnnouncement(announcementsFolder, getUser(), submission.getAnnouncementId());
Announcement announcement = submission.getAnnouncement(context.getAnnouncementService(), context.getAnnouncementsFolder(), getUser());
if (announcement == null)
{
processingResults.addAnnouncementNotFound(experimentAnnotationsId, submission, announcementsFolder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ void writePublicationList(ExperimentAnnotations experimentAnnotations)
HtmlList publicationList = new HtmlList();
if(experimentAnnotations.isPublished())
{
publicationList.addItem("Link: ", experimentAnnotations.getPublicationLink(), false);
publicationList.addItem("Link", experimentAnnotations.getPublicationLink(), false);

if(experimentAnnotations.hasPubmedId())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@
<li><strong>Organism:</strong> <%=h(annot.getOrganismsNoTaxId())%></li>
<%}%>
<%if(annot.getInstrument() != null){%>
<li><strong>Instrument:</strong> <%=h(annot.getInstrument())%></li>
<li><strong>Instrument:</strong> <%=h(annot.getInstrumentsCommaSeparated())%></li>
<%}%>
<%if(annot.getSpikeIn() != null){%>
<li><strong>SpikeIn:</strong>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@

import org.labkey.test.BaseWebDriverTest;
import org.labkey.test.Locator;
import org.labkey.test.WebTest;
import org.labkey.test.WebTestHelper;
import org.labkey.test.components.BodyWebPart;
import org.labkey.test.util.DataRegionTable;
import org.openqa.selenium.WebElement;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -83,6 +89,24 @@ public void clickMakePublic()
clickLink(elementCache().makePublicButton, "Expected to see a \"Make Public\" button");
}

public Integer getExperimentAnnotationsId()
{
WebElement moreDetailsLink = elementCache().moreDetailsLink;
if (moreDetailsLink != null)
{
String href = moreDetailsLink.getAttribute("href");
try
{
return Integer.parseInt(WebTestHelper.parseUrlQuery(new URL(href)).get("id"));
}
catch (MalformedURLException e)
{
throw new RuntimeException(e);
}
}
return null;
}

public void clickAddPublication()
{
clickLink(elementCache().addPublicationButton, "Expected to see a \"Add Publication\" button");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;

import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

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

// Verify that the submitter can make the data public
verifyMakePublic(PANORAMA_PUBLIC, targetFolder, SUBMITTER, true);
// Verify that a folder admin in the source folder, who is not the submitter or lab head will not see the
// "Make Public" button in the Panorama Public copy.
verifyMakePublic(PANORAMA_PUBLIC, targetFolder, ADMIN_2, false);
verifyMakePublicButtonIsNotVisible(PANORAMA_PUBLIC, targetFolder, ADMIN_2,
"Make Public button should not be visible in the Panorama Public copy to a user who is neither submitter nor lab head");

// Verify that the submitter can make the data public
verifyMakePublic(PANORAMA_PUBLIC, targetFolder, SUBMITTER, true);

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

// Data copy is pending. Verify that the "Make Public" button in not visible in the source folder or the copied folder
verifyMakePublicButtonIsNotVisible(PANORAMA_PUBLIC, targetFolder, SUBMITTER,
"Make Public button should not be visible in the Panorama Public copy if data copy is pending");
verifyMakePublicButtonIsNotVisible(projectName, folderName, SUBMITTER,
"Make Public button should not be visible in the source folder if data copy is pending");

// Verify that the submitter cannot enter the MakePublicAction URL in the browser to make the data public
verifyCannotMakePublicPendingResubmit(PANORAMA_PUBLIC, targetFolder, SUBMITTER); // In the target folder
verifyCannotMakePublicPendingResubmit(projectName, folderName, SUBMITTER); // In the source folder

// Re-copy the experiment to the Panorama Public project. Do not delete the previous copy
makeCopy(shortAccessUrl, experimentTitle, targetFolder, true, false);

// Verify that the "Make Public button is not visible in the older copy of the data.
String v1Folder = targetFolder + " V.1";
verifyMakePublic(PANORAMA_PUBLIC, v1Folder, SUBMITTER, true);
// Verify that the submitter can make data public, and add publication details
verifyMakePublicButtonIsNotVisible(PANORAMA_PUBLIC, v1Folder, SUBMITTER,
"Make Public button should not be visible in an older copy of the data");
verifyCannotMakePublicOldCopy(PANORAMA_PUBLIC, v1Folder, SUBMITTER);

// Verify that the submitter can make the latest copy of the data public, and add publication details
verifyMakePublic(PANORAMA_PUBLIC, targetFolder, SUBMITTER, true, true);
verifyMakePublic(PANORAMA_PUBLIC, v1Folder, ADMIN_2, false);

verifyIsPublicColumn(PANORAMA_PUBLIC, experimentTitle, true);

Expand Down Expand Up @@ -281,6 +297,64 @@ private void verifyMakePublic(String projectName, String folderName, String user
stopImpersonating();
}

private void verifyMakePublicButtonVisible(boolean expectVisible, String projectName, String folderName, String user, String errorMessage)
{
if (isImpersonating())
{
stopImpersonating(true);
}
goToProjectFolder(projectName, folderName);
impersonate(user);
goToDashboard();
TargetedMsExperimentWebPart expWebPart = new TargetedMsExperimentWebPart(this);

if (expectVisible)
{
assertTrue(errorMessage, expWebPart.hasMakePublicButton());
}
else
{
assertFalse(errorMessage, expWebPart.hasMakePublicButton());
}
}

private void verifyMakePublicButtonIsVisible(String projectName, String folderName, String user, String errorMessage)
{
verifyMakePublicButtonVisible(true, projectName, folderName, user, errorMessage);
}

private void verifyMakePublicButtonIsNotVisible(String projectName, String folderName, String user, String errorMessage)
{
verifyMakePublicButtonVisible(false, projectName, folderName, user, errorMessage);
}

private void verifyCannotMakePublicOldCopy(String projectName, String folderName, String user)
{
verifyCannotMakePublic(projectName, folderName, user, "not the most recent copy of the data");
}

private void verifyCannotMakePublicPendingResubmit(String projectName, String folderName, String user)
{
verifyCannotMakePublic(projectName, folderName, user, "There is a pending re-submit request for this experiment");
}

private void verifyCannotMakePublic(String projectName, String folderName, String user, String expectedMessage)
{
if (isImpersonating())
{
stopImpersonating(true);
}
goToProjectFolder(projectName, folderName);
impersonate(user);
goToDashboard();
TargetedMsExperimentWebPart expWebPart = new TargetedMsExperimentWebPart(this);
Integer expAnnotationsId = expWebPart.getExperimentAnnotationsId();
assertNotNull(expAnnotationsId);
beginAt(WebTestHelper.buildURL("panoramapublic", getCurrentContainerPath(), "makePublic", Map.of("id", expAnnotationsId)));
waitForText(expectedMessage);
}


private void makeDataPublic()
{
makeDataPublic(true);
Expand Down
Loading