When media is deleted, delete associated comments too.
The actual code is just a simple for loop; there might be a better implementation but this is a fine start. I also extended test_delete to check this too.
This commit is contained in:
@@ -173,6 +173,10 @@ def media_confirm_delete(request, media):
|
||||
if form.confirm.data is True:
|
||||
username = media.get_uploader.username
|
||||
|
||||
# Delete all the associated comments
|
||||
for comment in media.get_comments():
|
||||
comment.delete()
|
||||
|
||||
# Delete all files on the public storage
|
||||
delete_media_files(media)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user