Importing for others gives 500 error if author email address is blank and can't be automatically detected
Steps to reproduce:
Log in as an archivist
Post > Import Work
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
Check "Import for others ONLY with permission"
Fill in "Author Name"
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."
This 500 error is caused by trying to call each on nil in the story parser.
The relevant code:
Message now says, "We couldn't successfully import that work, sorry: No external author name or email specified"
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.
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.
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).