Uploaded Files Not Deleted After Post Rejection – Causes Unnecessary Resource Retention

AI-generated summary

Uploaded Files Not Deleted After Post Rejection causes unnecessary resource retention in Discourse. copymonopoly reported that uploaded files persist even after a post is rejected from the review queue, polluting the site with unused or potentially inappropriate content. merefield explained that orphaned uploads are cleared after a scheduled time using the clean_up_uploads setting, but copymonopoly clarified that files in the review queue never become isolated and are not cleaned up. sam suggested implementing a retention setting for the review queue to clear old rejected images, and has notified the product team.

Maybe a bug?

In Discourse, when a post is submitted and enters the review queue, any uploaded files associated with it seem to persist even after the post is rejected. I manually rejected a user’s post and even permanently deleted the system-generated private message that notified the user about the review result, but the uploaded image from that post is still visible in the review queue and stored on the server.

This kind of leftover media is problematic because it pollutes the site with unused or potentially inappropriate content, which negatively impacts the health and cleanliness of the community ecosystem.

Is this expected behavior? Shouldn’t Discourse automatically delete uploads from rejected posts? And is there any way to clean these up manually if not?

Orphaned uploads are cleared after a time with a scheduled sidekiq job.

settings: clean_up_uploads, clean_orphan_uploads_grace_period_hours

2 Likes

Sorry, I feel that I’ve already explained it clearly enough, but perhaps my English still needs improvement. I understand that isolated files will be cleaned up. The problem now is: if an uploaded file ends up in the review queue, it will never become an isolated file. I have already rejected the post in the review queue, and I even deleted the system’s rejection message sent to the user. However, the uploaded file can still be seen in the review queue. It hasn’t become an isolated file — that’s the issue.

1 Like

Ah thanks for the clarification, apologies that I missed that detail.

1 Like

Yeah I see the problem, I guess one possible solution would be to have some sort of retention setting for review queue so eventually we clear up old rejected images.

I let the product team know.

2 Likes