Skip to content

Commit 5e13fbc

Browse files
authored
Delete application comments with the application (#4585)
Small code change to delete all associated comments from an application when the application itself is deleted. OTF has gotten lots of account deletion requests recently and this has prevented accounts from being deleted - applications are deleted but the comments prevent staff from deleting the account There will probably be a bigger pass at these for data retention stuff later on but this is just a start
1 parent 43c3968 commit 5e13fbc

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

hypha/apply/funds/views/submission_delete.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ def form_valid(self, form):
4444
source=submission,
4545
)
4646

47-
# Delete NEW_SUBMISSION event for this particular submission, if any.
47+
# Delete NEW_SUBMISSION & COMMENT events for this particular submission, if any.
4848
# Otherwise, the submission deletion will fail.
4949
Event.objects.filter(
50-
type=MESSAGES.NEW_SUBMISSION, object_id=submission.id
50+
type__in=[MESSAGES.NEW_SUBMISSION, MESSAGES.COMMENT],
51+
object_id=submission.id,
5152
).delete()
5253

5354
# delete submission and redirect to success url

hypha/apply/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def process_exception(self, request, exception):
1313
messages.error(
1414
request,
1515
_(
16-
"The object you are trying to delete is used somewhere. Please remove any usages and try again!."
16+
"The object you are trying to delete is used somewhere. Please remove any usages and try again!"
1717
),
1818
)
1919
return HttpResponseRedirect(request.path)

0 commit comments

Comments
 (0)