well, in the process of fixing file previews for new issues, another problem has been created.
the attached file is now associated directly w/ the user session, so if you upload a file in a preview, then decide against attaching it, it's stuck in your session, and you carry it around to any other issue or issue comment as an already uploaded file.
this could result in a file accidentally getting uploaded. at this point the only way to evacuate the preview file is to either upload another to replace it, or log out and back in so you have a fresh session.
this problem has probably always been around in some lesser form, but is now exacerbated by the fact that file previews in issue followups are no longer associated w/ the issue node itself.
not sure how best to handle this. even if we re-associate the file previews for issue followups to the node of the issue, it still doesn't completely fix the problem. not to mention that i see no reliable way to associate a file upload with a new issue creation -- it would be carried to any other new issue creation.
my best plan atm is:
- change the logic back for issue folowups so that files are associated with the issue node. this will at least fix any cross issue errors.
- either advise users who have a file stuck from previewing to log out and back in, or...
- add a 'Remove file' button when a file has been uploaded in preview.
or maybe there's some way to associate the file in the user session subject to the actual form instance you're on, but i'm not seeing it...
Comments
Comment #1
dwwI don't know exactly what changed that caused files to be associated with user sessions instead of issues in the first place. But, from the description of this issue, your plan mostly seems fine. I think i'd rather see a "remove file" button than a warning "if you don't want to upload that file, please log out and log back in" -- that seems like an utter hack and usability disaster. ;) the "remove file" button could also be a good way to garbage collect stale files that were uploaded but not actually attached, right?
Comment #2
hunmonk commentedissue followup files were previously stored in $node->file. to keep the code simple, they were moved to the user session (where the initial issue files are now kept). now of course i see that as a dumb move, b/c of the problem we're having :)
i also vote for the remove file button, even though it will be a bit more work.
Comment #3
hunmonk commentedafter further investigation:
project_issue_comment_validate(&$node)is called even when a brand new followup is loaded, and that function loads whatever is in 'file_issue' into $node->file. basically, even before my patch, if you uploaded a file and didn't submit it, you carried it around with you until you did submit it, or your session expired.i'm leaving this set to active, and recommending that if anybody wants it fixed in versions < Drupal 6.x, to work up a patch that adds a 'Remove file' button any time there's a file already in 'file_issue', and i'll be happy to commit it once we branch for Drupal 5.
Comment #4
hunmonk commentedComment #5
hunmonk commentedno longer a problem since IFAC landed. could use a backport of the recommended fix if anybody is interested.
Comment #6
aclight commentedSince we're no longer supporting the 5.x-1.x branch of pi, I'm setting this to fixed.
Comment #7
dwwSounds good. Fixed in 5.x-2.x-dev then. ;)
Comment #8
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.