Skip to content

Commit

Permalink
Fix issues with notifications on API 2.0 and 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
amontenegro committed Jul 4, 2024
1 parent ddf3e67 commit 39dc43a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public PeerReview updatePeerReview(String orcid, PeerReview peerReview, boolean

existingEntity = peerReviewDao.merge(existingEntity);
peerReviewDao.flush();
notificationManager.sendAmendEmail(orcid, AmendedSection.PEER_REVIEW, createItemList(existingEntity, ActionType.UPDATE));
notificationManager.sendAmendEmail(orcid, AmendedSection.PEER_REVIEW, createItemList(existingEntity, ActionType.UPDATE, peerReview.getExternalIdentifiers(), peerReview.getSubjectExternalIdentifier()));
return jpaJaxbPeerReviewAdapter.toPeerReview(existingEntity);
}

Expand Down Expand Up @@ -238,10 +238,6 @@ private void validateGroupId(PeerReview peerReview) {
}
}

private List<Item> createItemList(PeerReviewEntity peerReviewEntity, ActionType type) {
return createItemList(peerReviewEntity, type, null, null);
}

private List<Item> createItemList(PeerReviewEntity peerReviewEntity, ActionType type, ExternalIDs extIds, ExternalID subjectExtId) {
Item item = new Item();
item.setItemType(ItemType.PEER_REVIEW);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,11 @@ public boolean checkSourceAndRemoveWork(String orcid, Long workId) {
boolean result = true;
WorkEntity workEntity = workDao.getWork(orcid, workId);
orcidSecurityManager.checkSource(workEntity);
Work work = jpaJaxbWorkAdapter.toWork(workEntity);
try {
workDao.removeWork(orcid, workId);
workDao.flush();
notificationManager.sendAmendEmail(orcid, AmendedSection.WORK, createItemList(workEntity, null, ActionType.DELETE));
notificationManager.sendAmendEmail(orcid, AmendedSection.WORK, createItemList(workEntity, work.getExternalIdentifiers(), ActionType.DELETE));
} catch (Exception e) {
LOGGER.error("Unable to delete work with ID: " + workId);
result = false;
Expand Down

0 comments on commit 39dc43a

Please sign in to comment.