That is great! Really nice solution. ![]()
I wonder if using the same strategy of stripping markdown upload references in posts could make sense for the reverse scenario, when an upload is destroyed but posts referencing it remain live.
If I destroy an upload like:
Upload.find(123).destroy
If upload 123 was used by any users for:
- profile custom avatar
- profile background
- card background
All the references are wiped, seemingly from:
before_destroy (wipe background/card banner upload references)
after_destroy (wipe avatar upload references)
If the post ids associated with an upload id could be used to queue stripping the upload markdown when destroyed, I think that could potentially prevent dead upload references in non-deleted posts when an upload is manually destroyed.
Ideally preserving upload markdown for any upload ids that were not destroyed, if say, one post has two uploads but only one was destroyed.
E.g. If deleting an upload referenced in more than one post (such as quote posts) via https://meta.discourse.org/t/legal-compliance-plugin/356331 or the rails CLI.