Closed Bug 1026639 Opened 11 years ago Closed 9 years ago

Provide a way to delete file attachments

Categories

(developer.mozilla.org Graveyard :: File attachments, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jbennett, Assigned: jezdez)

References

Details

(Whiteboard: [LOE?])

Currently there is no way to delete attachments. See also bug 779541, which requested auto-deletion when the page is deleted (but was rejected since the same file may be used on other pages).
Blocks: 1026638
:groovecoder, can you estimate effort on this?
Flags: needinfo?(lcrouch)
Whiteboard: [LOE?]
303 :ubernostrum
Flags: needinfo?(lcrouch) → needinfo?(jbennett)
The main thing holding this up is a spec of how it's supposed to behave. In the past this request was to emulate MindTouch behavior, where a single file was tied to a single document, would need to be re-uploaded to be used in another document, and deletion of the document would delete all associated files. I would like to think we no longer need to emulate the MindTouch workflow, but I can't say that for certain. So we'd need some sort of description of expected behavior from the folks who'd be using the deletion feature.
Flags: needinfo?(jbennett)
For attachments that are only used by a single page, there is no problem. In case an attachment is used by multiple pages, I see three solutions: 1. Forbid deletion As long as there are several references to an attachment, there's no way to delete it. Authors first need to edit the articles to remove the references before they can delete the attachment. 2. Allow deletion but give a warning Let the user delete the attachment, though give him a list of pages, which still reference it and tell him to remove the references. 3. Allow deletion without warning Let the user delete the attachment without a hint about the referencing pages. I'd exclude the third solution, because it breaks pages without warning. For the first two solutions it depends on whether the user should be forced to update the related pages. One question is also whether to offer a page listing all attachments like MediaWiki is doing it (see e.g. the Firebug wiki.[1]) or whether to allow their deletion only from within the referencing pages. Sebastian [1] https://getfirebug.com/wiki/index.php/Special:UnusedFiles
See Also: → 779541
Note that any admin can delete attachments. So pinging one of them is a work around for now (not very discoverable though)
Assignee: nobody → jezdez
Status: NEW → ASSIGNED
Commits pushed to master at https://github.com/mozilla/kuma https://github.com/mozilla/kuma/commit/25ae0e1c20cbb7be7b3c81da90ac1cff3f276e68 Fix bug 1026639 - Allow deleting attachments. This moves attachment revision files into a trash. There is a management command to purge the trash after a number of days that should be run regularly via cron. This again extends the attachments admin UI somewhat to support this new feature. It's not offered to the front-end users at all. https://github.com/mozilla/kuma/commit/874e831f27af44620d9a8a82bc9287153e5f4884 Bug 1026639 - Refactored and expanded attachment tests. https://github.com/mozilla/kuma/commit/5042d2972872a0a6b046317681168f913b3aa452 Bug 1026639 - Allow fetching missing attachments from main site during development. https://github.com/mozilla/kuma/commit/341c85da942e2b82daabd4649f82bf2cc484ca08 Bug 1026639 - Improve attachment deletion. - raise exception when deleting last revision of attachment via ORM call - prevent deleting last revision in admin by disabling the delete option - after deleting a revision make previous attachment revision the current one - disable admin delete action since they eluded modification https://github.com/mozilla/kuma/commit/40a8ce5833ece3774798d61c353848a0eea68c30 Bug 1026639 - Catch OS error when trying to find filesize for non-existing file. https://github.com/mozilla/kuma/commit/d72856aec1ea3635f66f174184640ea9b43dbcd0 Bug 1026639 - Further improve the deletion workflow. This makes the deletion only block deleting an attachment revision if the deletion doesn't originate on the attachment admin as that would indicate the deletion of all revisions in the first place. https://github.com/mozilla/kuma/commit/313d69a1c6d640f5359f962205f5ee96e006a16e Bug 1026639 - Add migration for the on_delete change in the Attachment model.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Depends on: 1254307
Commit pushed to master at https://github.com/mozilla/kuma https://github.com/mozilla/kuma/commit/e872ec3026a543a0b5e911a7339a9c1c9e352552 bug 1026639 - Anonymize DeletedAttachments table This table was omitted from databases created with clone_db
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.