Pseud: "Orphan Works" gives a 500 error if the user has multiple pseuds on the same work
Steps to reproduce:
1. Log in
2. Hi, username! > My Preferences > Manage My Pseuds > New Pseud
3. Fill in the "Name" field with a name for your pseud, e.g. Pseud To Orphan
4. Press "Create"
5. Back To Pseuds > New Pseud
6. Fill in the "Name" field with a name for your pseud, e.g. Pseud To Keep
7. Press "Create"
8. Post > New Work
9. Fill in required fields
10. Under "Creator/Pseud(s)," choose both Pseud To Orphan and Pseud To Keep
11. Press "Post Without Preview"
12. Hi, username! > My Preferences > Manage My Pseuds
13. Under "Pseud To Orphan," press "Orphan Works"
14. Leave "Take my pseud off as well" selected
15. Press "Yes, I'm Sure"
I get a 500 error, but the work is properly orphaned: the pseud "Pseud To Orphan" is removed from the work and replaced with "orphan_account," while "Pseud To Keep" stays on the work.
What should happen:
Instead of receiving an error page, I should be redirected to my dashboard (http://test.archiveofourown.org/users/USERNAME) with a success message saying, "Orphaning was successful."
The same error happens if you choose "Leave a copy of my pseud on" in step 14. Orphaning a work with only one pseud attached works just fine.
I think this is what we want.
I tried this both with leaving my pseud on and taking my pseud off and it worked as expected both times!
Screenshot of the page for orphaning:
Yikes. That seems decidedly worse. It might be time to bump the priority on this.
I think the changes in creatorships resulting from the Creatorship Invitation feature fixed the 500 error, but the behavior still doesn’t match the “what should happen” description. Instead of leaving “Pseud to Keep” on the work, the orphan page removes both “Pseud to Keep” and “Pseud to Orphan,” so that the user no longer has any control over the work.
As far as I can tell, the issue is that when you click the “Orphan Works” button for the pseud, it passes the pseud_id to the new action of the OrphansController. But instead of displaying the orphans/orphan_pseud view (which wouldn’t display a list of the pseud’s works, but would include the pseud_id in the form), it displays the the orphans/orphan_work view (which does display the list of the works, but doesn’t include the pseud_id in the form). This means that when the user submits the form, pseud_id isn’t passed to the OrphansController, and so the OrphansController treats it as though the user is trying to remove all their pseuds from the works in question, instead of one particular pseud.