Skip to content

Commit 9e651dc

Browse files
Set last reviewed date and reviewer when note is added (#14209)
* Set last reviewed date and reviewer for finding Update finding's last reviewed date and reviewer to maintain parity with UI behaviors * Apply suggestion from @Maffooch * Set last reviewed date and author for finding Update finding with last reviewed date and author. * Apply suggestions from code review * Apply suggestion from @Maffooch --------- Co-authored-by: valentijnscholten <valentijnscholten@gmail.com>
1 parent 9864582 commit 9e651dc

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

dojo/api_v2/views.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,9 @@ def notes(self, request, pk=None):
11241124
note_type=note_type,
11251125
)
11261126
note.save()
1127+
finding.last_reviewed = note.date
1128+
finding.last_reviewed_by = author
1129+
finding.save(update_fields=["last_reviewed", "last_reviewed_by", "updated"])
11271130
finding.notes.add(note)
11281131
# Determine if we need to send any notifications for user mentioned
11291132
process_tag_notifications(

dojo/jira_link/views.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,11 @@ def check_for_and_create_comment(parsed_json):
285285
finding.notes.add(new_note)
286286
finding.jira_issue.jira_change = timezone.now()
287287
finding.jira_issue.save()
288-
# Only update the timestamp, not other fields like 'active' to avoid
288+
finding.last_reviewed = new_note.date
289+
finding.last_reviewed_by = author
290+
# Only update the timestamp fields, not other fields like 'active' to avoid
289291
# race conditions with concurrent webhook events (e.g. issue_updated)
290-
finding.save(update_fields=["updated"])
292+
finding.save(update_fields=["last_reviewed", "last_reviewed_by", "updated"])
291293
return None
292294

293295

0 commit comments

Comments
 (0)