Importing for others gives 500 error if author email address is blank and can't be automatically detected

Description

Steps to reproduce:

  1. Log in as an archivist

  2. Post > Import Work

  3. Fill in a URL, but it can't be from a site where we can automatically detect email addresses (slashdom.net or a journal site like LiveJournal) – it might be easiest to use something totally off the wall, like a JIRA issue

  4. Check "Import for others ONLY with permission"

  5. Fill in "Author Name"

  6. Press "Import"

What happens:
I get a 500 error.

What should happen instead:
I should be directed back to the import page with a red flash error saying roughly, "Author Email Address cannot be blank when importing for others." (If you find an existing error message somewhere in the code, please use that instead. I couldn't find one.)

This error also happens if you leave both Author Name and Author Email Address blank. If Author Name is left blank, that will need an error message saying, "Author Name cannot be blank when importing for others."

Notes:
This 500 error is caused by trying to call each on nil in the story parser.

The error:

The relevant code:

Activity

Show:
Lady Oscar
September 30, 2017, 5:37 PM

Confirmed!

Sarken
September 30, 2017, 12:33 AM

Message now says, "We couldn't successfully import that work, sorry: No external author name or email specified"

Looks good!

Ariana
September 27, 2017, 7:47 PM

Upon reflection, I can change that error message to only say

Since the piece of code that makes up email addresses only works for LiveJournal, we probably don't need to mention it - as Alison said, it's just confusing.

Alison Watson
September 27, 2017, 10:08 AM

I tested importing for others this very jira issue.

Leaving the email address blank only, i was returned to the import page with the message "We couldn't successfully import that work, sorry: No author email specified"

Leaving both fields blank, i was returned to the importer with the message "We couldn't successfully import that work, sorry: No external author name or email specified, and unable to generate email based on source location"

This seems to be working as expected, but I will note that the last part of error message 2 is a bit obscure, and doesn't mirror the first message.

Ariana
July 6, 2017, 9:14 AM
Edited

Testing

Follow the Steps to Reproduce above, taking care to import from a random site that is not Livejournal, Deviantart or Dreamwidth (the code detects an email address for those sites and so won't trigger the error).

DeployedToBeta

Assignee

Ariana

Reporter

Sarken

Roadmap

Work Importing

Priority

Medium

Affects versions

Fix versions

Components

BackEnd

Difficulty

Medium

Required Access Level

Archivist

Milestone

Internal 0.9