Skip to content

Commit 64960fb

Browse files
committed
Add note history tracking to Engagement, Finding, and Test viewsets
1 parent 0195675 commit 64960fb

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

dojo/api_v2/views.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
Languages,
122122
Network_Locations,
123123
Note_Type,
124+
NoteHistory,
124125
Notes,
125126
Notification_Webhooks,
126127
Notifications,
@@ -532,6 +533,10 @@ def notes(self, request, pk=None):
532533
note_type=note_type,
533534
)
534535
note.save()
536+
# Add an entry to the note history
537+
history = NoteHistory.objects.create(data=note.entry, time=note.date, current_editor=note.author)
538+
note.history.add(history)
539+
# Now add the note to the object
535540
engagement.notes.add(note)
536541
# Determine if we need to send any notifications for user mentioned
537542
process_tag_notifications(
@@ -1125,6 +1130,10 @@ def notes(self, request, pk=None):
11251130
note_type=note_type,
11261131
)
11271132
note.save()
1133+
# Add an entry to the note history
1134+
history = NoteHistory.objects.create(data=note.entry, time=note.date, current_editor=note.author)
1135+
note.history.add(history)
1136+
# Now add the note to the object
11281137
finding.last_reviewed = note.date
11291138
finding.last_reviewed_by = author
11301139
finding.save(update_fields=["last_reviewed", "last_reviewed_by", "updated"])
@@ -2188,6 +2197,10 @@ def notes(self, request, pk=None):
21882197
note_type=note_type,
21892198
)
21902199
note.save()
2200+
# Add an entry to the note history
2201+
history = NoteHistory.objects.create(data=note.entry, time=note.date, current_editor=note.author)
2202+
note.history.add(history)
2203+
# Now add the note to the object
21912204
test.notes.add(note)
21922205
# Determine if we need to send any notifications for user mentioned
21932206
process_tag_notifications(

0 commit comments

Comments
 (0)