freerange/jam-coop

Error on saving loses all uploads

Closed this issue · 9 comments

Wanted to upload a new album, but setting it in the future (kinda wanted to create a preorder) errored at the end of saving (after uploads) and this caused all uploads to dissapear - tracks and the cover - text entries have persisted in the form.

it woud be much better if such error would not loose uploads and require to upload everything again.

to recreate: create new album, fill in all text fields, set release date in the future, upload a track and a cover, click save. wait for uploads and after that the form errors out and uploads are gone.

@lukaprincic Thanks for reporting this. We only recently introduced the validation check in #141 and we clearly overlooked this scenario - sorry that it caused you more work. We have discussed the idea of scheduling releases in the future (e.g. #141 (comment)), but we'll need to do some specific thinking about it. I've captured it in its own new issue here: #155.

I've looked into this a bit further and I think there are at least two problems:

  1. Uploaded track files are retained after a validation error the first time an album is saved, but apparently lost the second and subsequent times...? 🤷
  2. When uploaded track files are retained, it's not very obvious in the UI - we just display the filename in parentheses at the end of the file field's label. I think it might be clearer to hide the file field control by default if the file has already been uploaded, but provide a "Change" link to make it visible in case you want to upload a new file.

@chrislo What do you think?

Ugh, yes the multiple file upload is all a bit janky. (1) definately sounds like a problem we should try to fix. (2) sounds like a good improvement - making a better distinction between uploaded and non-uploaded files would be good.

I cobbled together the direct upload javascript based on the rails guide. I certainly wouldn't be against replacing it altogether with a 3rd party library if we thought it'd make things more robust. We could also consider decoupling the editing of track metadata (like titles etc) from adding/editing tracks too if that helped? So that validation errors on those fields were decoupled from the long upload times of multiple tracks.

I appreciate that second paragraph is vaguer and probably involves more work - I just wanted to make clear I'm not wedded to the way things currently work 😄

I certainly wouldn't be against replacing it altogether with a 3rd party library if we thought it'd make things more robust. We could also consider decoupling the editing of track metadata (like titles etc) from adding/editing tracks too if that helped? So that validation errors on those fields were decoupled from the long upload times of multiple tracks.

That sounds worth considering. I had a quick look around and I've come across Dropzone & Uppy. The latter is possibly interesting, because it allows uploading directly from Dropbox, Google Drive, etc to Amazon S3, although it sounds as if you need to run this server application somewhere to get that functionality. Do you know anything about either of them and/or do you know of any other libraries that might be suitable?

A quicker/short-term fix might be to add some client-side validation on the release date field...?

@chrislo What's generating the date picker for the release date on the album form...?

@chrislo What's generating the date picker for the release date on the album form...?

Doh! I belatedly realised it's Firefox's native date picker for input[type='date']!

thanks for working on this and getting a solution.
i suppose the 'pre-order' feature would be implemented independently from this?

@lukaprincic

Yeah, this was just a quick fix so nobody else has the annoying experience that you had.

I captured the idea of scheduling an album release in the future in #155, but it sounds as if you might be talking about something different when you talk about a pre-order. It would be great if you could explain a bit more about how you'd like that to work - either add a comment to #155 or create a new issue - we'd love to hear your thoughts.

I've also just created a new issue about improving the UI for creating an album in #157 to reflect some of @chrislo's suggestions above.