fromthepage icon indicating copy to clipboard operation
fromthepage copied to clipboard

500 error when no collection selected when creating a new work

Open sylvieed opened this issue 2 years ago • 1 comments

It's possible to upload a file with no collection selected by exiting out of adding a new collection, which causes a 500 error.

Steps to reproduce:

  1. Go to "Start a Project" page
  2. Select "Upload PDF or ZIP File"
  3. In "Select a collection", select "Add New Collection"
  4. Exit out of the "Create New Collection" popup
  5. The collection dropdown will still say "Add New Collection"
  6. Select a file to upload
  7. Click "Upload File"
  8. 500 error

If you do the same thing for creating an empty work, there's no errors but the work isn't actually created, which could be confusing to users.

Steps to reproduce:

  1. Go to "Start a Project" page
  2. Select "Upload PDF or ZIP File"
  3. In "Select a collection", select "Add New Collection"
  4. Exit out of the "Create New Collection" popup
  5. The collection dropdown will still say "Add New Collection"
  6. Add a title and description
  7. Click "Create Work"
  8. You're redirected to https://fromthepage.com/findaproject#create-page
  9. If you look in your dashboard, there is no work

User thoughts from UX intern:

I changed my mind about uploading a PDF and exited out of the “Create New Collection” screen.

Then I decided to upload a file after all. However, after exiting out of the “Create New Collection” screen, I can still upload a file without creating a new collection but this generates an error.

It’s not immediately clear to me how to get the “Create New Collection” pop up screen back.

sylvieed avatar Jul 12 '22 14:07 sylvieed

yes, unable to upload files and create a project I, [2022-09-02T17:35:55.678863 #6963] INFO -- : [9c1fbed0-0914-4c17-8113-6d4e98092e6f] Started POST "/dashboard/new_upload" for 2409:4071:d9d:1f9e:a90b:f277:c78e:8339 at 2022-09-02 17:35:55 +0530 I, [2022-09-02T17:35:55.680130 #6963] INFO -- : [9c1fbed0-0914-4c17-8113-6d4e98092e6f] Processing by DashboardController#new_upload as HTML I, [2022-09-02T17:35:55.680326 #6963] INFO -- : [9c1fbed0-0914-4c17-8113-6d4e98092e6f] Parameters: {"authenticity_token"=>"H3aOnS+5Nxik5SMprqifpU+uAe0xeF7yHP9XI8mH/ZPgLCUxSnCb5/9OTwMKy1xbXzIoloJaPTWxLGvka91L/w==", "document_upload"=>{"collection_id"=>"2", "file"=>#<ActionDispatch::Http::UploadedFile:0x00005594fb130890 @tempfile=#<Tempfile:/tmp/RackMultipart20220902-6963-9dk97q.pdf>, @original_filename="592 (1).pdf", @content_type="application/pdf", @headers="Content-Disposition: form-data; name=\"document_upload[file]\"; filename=\"592 (1).pdf\"\r\nContent-Type: application/pdf\r\n">, "preserve_titles"=>"0", "ocr"=>"0"}, "button"=>""} I, [2022-09-02T17:35:55.709018 #6963] INFO -- : [9c1fbed0-0914-4c17-8113-6d4e98092e6f] Completed 500 in 28ms (ActiveRecord: 9.4ms | Allocations: 17725) F, [2022-09-02T17:35:55.712804 #6963] FATAL -- : [9c1fbed0-0914-4c17-8113-6d4e98092e6f] [9c1fbed0-0914-4c17-8113-6d4e98092e6f] NameError (uninitialized constant #<Class:0x00005594fca205d0>::RAKE Did you mean? Rake): [9c1fbed0-0914-4c17-8113-6d4e98092e6f] [9c1fbed0-0914-4c17-8113-6d4e98092e6f] app/models/document_upload.rb:19:in submit_process' [9c1fbed0-0914-4c17-8113-6d4e98092e6f] app/helpers/add_work_helper.rb:31:in new_upload'

omshivaprakash avatar Sep 02 '22 12:09 omshivaprakash

@saracarl

If you do the same thing for creating an empty work, there's no errors but the work isn't actually created, which could be confusing to users.

Steps to reproduce:

Go to "Start a Project" page Select "Upload PDF or ZIP File" In "Select a collection", select "Add New Collection" Exit out of the "Create New Collection" popup The collection dropdown will still say "Add New Collection" Add a title and description Click "Create Work" You're redirected to https://fromthepage.com/findaproject#create-page If you look in your dashboard, there is no work

Reason: In the above mentioned issue user is redirected and in the dashboard there is no work. From the UI we can only view works if we select the collection and then we can see all the works in that collection, what really happening is that we are creating a work without selecting any collection and in the DB Work gets created with collection_id: nil there for newly created work is not showing.

Possible Fix: One possible solution could be to add a check before creating a work i.e if collection_id is nill then prompt the user to select a collection. What do you suggest?

About 2nd Problem: User thoughts from UX intern:

I changed my mind about uploading a PDF and exited out of the “Create New Collection” screen. Then I decided to upload a file after all. However, after exiting out of the “Create New Collection” screen, I can still upload a file without creating a new collection but this generates an error. It’s not immediately clear to me how to get the “Create New Collection” pop up screen back.

Remedy: Just select any other option from the drop down and then select again the “Create New Collection” pop up will be shown.

symmetrically avatar Apr 05 '23 12:04 symmetrically

@symmetrically let's hold off on this -- my fault for assigning it -- because we've got the new UI in #3068 (for new projects/collections) that we're going to work on that I think will make this irrelevant. I'm going to take your name off of it, and we'll close it after we get the new configuration screen in place. (There may be other issues tagged "onboarding" that are similar.)

saracarl avatar Apr 05 '23 14:04 saracarl