Skip to content

Commit 8c38caf

Browse files
authored
Merge pull request #1065 from WildMeOrg/415_log_annotation_deletion
add audit comment about deletion of annotation
2 parents 79ee2b4 + 21bc547 commit 8c38caf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main/java/org/ecocean/servlet/EncounterRemoveAnnotation.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public void doPost(HttpServletRequest request, HttpServletResponse response)
8787
enc.getAnnotations().contains(myShepherd.getAnnotation(annotID))
8888
) {
8989
Annotation ann = myShepherd.getAnnotation(annotID);
90+
User user = myShepherd.getUser(request);
9091
// overall: don't delete trivial annotations. in that case, delete image command from menu
9192
// if not trivial but has no sibs, revert to trivial
9293
if (!ann.isTrivial() &&
@@ -100,6 +101,9 @@ public void doPost(HttpServletRequest request, HttpServletResponse response)
100101
}
101102
Annotation newAnnot = ann.revertToTrivial(myShepherd);
102103

104+
enc.addComments("<p data-annot-id=\"" + ann.getId() +
105+
"\">Annotation deleted by " + user.getDisplayName() + " on " +
106+
Util.prettyTimeStamp() + "</p>");
103107
myShepherd.getPM().deletePersistent(ann);
104108
myShepherd.updateDBTransaction();
105109
res.put("revertToTrivial", true);
@@ -113,6 +117,9 @@ else if (!ann.isTrivial()) {
113117
myShepherd.updateDBTransaction();
114118
}
115119
}
120+
enc.addComments("<p data-annot-id=\"" + ann.getId() +
121+
"\">Annotation deleted by " + user.getDisplayName() + " on " +
122+
Util.prettyTimeStamp() + "</p>");
116123
enc.removeAnnotation(ann);
117124
myShepherd.getPM().deletePersistent(ann);
118125
myShepherd.commitDBTransaction();

0 commit comments

Comments
 (0)