Skip to content

Commit

Permalink
move email notification at the end of status change transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
wangf1122 committed Mar 13, 2024
1 parent ca2bf40 commit 5ca5b1f
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,6 @@ public Map<Integer, StatusChangeType> onStatusChange(List<MetadataStatus> listOf
// we know we are allowed to do the change, apply any side effects
boolean deleted = applyStatusChange(status.getMetadataId(), status, statusId);

// inform content reviewers if the status is submitted
try {
notify(getUserToNotify(status), status);
} catch (Exception e) {
context.warning(String.format(
"Failed to send notification on status change for metadata %s with status %s. Error is: %s",
status.getMetadataId(), status.getStatusValue().getId(), e.getMessage()));
}

if (deleted) {
results.put(status.getMetadataId(), StatusChangeType.DELETED);
} else {
Expand All @@ -208,6 +199,15 @@ public Map<Integer, StatusChangeType> onStatusChange(List<MetadataStatus> listOf
}
}

// inform content reviewers if the status is submitted
try {
notify(getUserToNotify(status), status);
} catch (Exception e) {
context.warning(String.format(
"Failed to send notification on status change for metadata %s with status %s. Error is: %s",
status.getMetadataId(), status.getStatusValue().getId(), e.getMessage()));
}

}

return results;
Expand Down

0 comments on commit 5ca5b1f

Please sign in to comment.