silverstripe-asset-admin
silverstripe-asset-admin copied to clipboard
UploadField implies file deletion when it actually detaches it
UploadField generally saves into a relationship, with the ability to pick an existing file, or upload a new one. When a file is associated in this way, there's a "cross" icon to disassociate it again.
That makes perfect sense when you've just selected an existing file, but is a bit misleading when uploading a new one. Authors might reasonably expect that a file they've just uploaded on this page would be removed from the system when using the "cross" icon.
This becomes a high impact issue when combined with other long-standing system behaviours:
- The record containing the UploadField is published, which often also publishes the file (through ownership and cascading publish)
- When that record gets removed, files associated with it are generally not removed as well - files are always assumed to be a "many-many" relationship
- Public files are accessible even without a record that contains them, e.g. because they were picked up by Google while published on a page, or because of an internal search engine indexing files.
Long story short, I think we should change this icon to the "break chain", similar to what we use in GridField. Additionally, we could change the "cross" icon to a context menu (three dots), as indicated in the designs. This would allow us to label the action more clearly as "unlink".
I don't believe we should offer a "delete/archive" option here, because we don't have 100% accurate link tracking, and this could break uses of the file elsewhere. It's too easy to assume it's only deleted in the context of a single page usage. If authors want to delete a file, they can do it via the asset admin UI, where the context is clearer.
/cc @silverstripe/ux-contributors
Internal reference: https://www.cwp.govt.nz/service-desk/requests?target=view.php%3Fid%3D46536
Related: https://github.com/silverstripe/silverstripe-asset-admin/issues/1002
Whatever the desision is here, it should include proper messaging to the user that the file has been unlinked, not deleted. If they are mislead into thinking the file is 'deleted' (through misinterpretation of the icon, lack of messaging or whatever) then that raises security concerns with me. "I accidentally uploaded my passport but thank goodness I was able to delete it"