﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
21194,Delete attachment AJAX fails when EMPTY_TRASH_DAYS is set to 0 days,simonwheatley,ryan,"To replicate:

 1. Set ```EMPTY_TRASH_DAYS``` to 0 (zero) in ```wp-config.php``` 
 2. Edit a post
 3. Upload a file (e.g. image) through via the edit post screen
 4. Attempt to delete the file
 5. Get error ```“apple” has failed to upload. You do not have permission. Has your session expired?```

The problem is that the JS is binding an AJAX call to the ```a.delete``` element in ```handlers.dev.js```, but incorrectly specifying the action as ```trash-post``` rather than ```delete-attachment``` which is what the nonce action was set as.

Possible solutions:

 * Either the nonce needs to be created with the ```trash-post``` action (seems wrong)
 * The class of the element needs to change so it doesn't attract the JS binding
 * The class of all current delete links should be renamed to ```trash```, which seems more accurate but it kind of a big thing which will probably introduce other bugs
 * Something I've not thought of…",defect (bug),closed,normal,3.5,Media,2.0,normal,fixed,has-patch commit,kpayne@…
