Complete Allow the user to delete the rules file from the downloads#1219
Complete Allow the user to delete the rules file from the downloads#1219brian-kim31 wants to merge 12 commits into
Conversation
| deleted_at = models.DateTimeField(null=True, blank=True) | ||
| deleted_by = models.ForeignKey( | ||
| settings.AUTH_USER_MODEL, | ||
| on_delete=models.SET_NULL, |
There was a problem hiding this comment.
I think we need to decide the behaviour when the associated user is deleted: either keeping the file for record (as you did here) or deleting the associated files as well (as @AndyRae did in line 54)
There was a problem hiding this comment.
I don't think the above is about the case when the associated users are deleted. Anyway, we can come back to this later when Andy comes back (I don't think this is a blocker for other PRs), or you can decide as the PR author. I just want the deleting behaviour to be consistent.
| <DialogHeader className="text-start"> | ||
| <DialogTitle>Delete File</DialogTitle> | ||
| </DialogHeader> | ||
| <p className="text-sm text-muted-foreground"> |
There was a problem hiding this comment.
can you please show me how it looks if we have text-sm text-muted-foreground? I can't check it. Just want to make sure the text look okay and clear in dark and light mode.
There was a problem hiding this comment.
| get_queryset(): | ||
| Retrieves the queryset of FileDownload objects filtered by the scan report ID. | ||
| Retrieves the queryset of FileDownload objects filtered by the scan report ID | ||
| and age (files older than OLD_FILE_THRESHOLD are excluded). |
There was a problem hiding this comment.
this is not longger correct



✨ Feature
PR Description
The purpose of this PR is to let users clean up their downloads by deleting rules files they no longer need. When someone deletes a file, we remove it from storage to save space, but keep a record in the database so we can track what was generated and when it was deleted. We also automatically hide files older than 30 days to keep the downloads page tidy (you can change this with the FILE_RETENTION_DAYS setting).
Related Issues or other material
Related #856
Closes #856
Screenshots, example outputs/behaviour etc.