Repository: internetarchive/openlibrary

Issue:
Add New Edition page only shows one author
When adding new edition to books that have two or more authors, only one author is shown on Add form.

### Evidence / Screenshot (if possible)
Work page
![зображення](https://github.com/internetarchive/openlibrary/assets/58372007/351f20e4-841b-43bb-a36e-dcbe0346dfad)
Adding new edition
![зображення](https://github.com/internetarchive/openlibrary/assets/58372007/865fe644-6bb9-4a8a-b29a-94c3afbd134f)

### Relevant url?
https://openlibrary.org/books/OL49228318M/Solo_Leveling
https://openlibrary.org/works/OL27293006W/%D0%AF%D0%BF%D0%BE%D0%BD%D1%81%D1%8C%D0%BA%D0%B0_%D0%BB%D1%96%D1%82%D0%B5%D1%80%D0%B0%D1%82%D1%83%D1%80%D0%B0

### Steps to Reproduce
<!-- What steps caused you to find the bug? -->
1. Go to ... any book that has two authors
2. Do ... press Add new edition

<!-- What actually happened after these steps? What did you expect to happen? -->
* Actual: form shows only one author
* Expected: form shows all authors added to work

### Details

- **Logged in (Y/N)?** Y
- **Browser type/version?** Firefox 114
- **Operating system?** Linux Mint
- **Environment (prod/dev/local)?** prod
<!-- If not sure, put prod -->

### Proposal & Constraints
<!-- What is the proposed solution / implementation? Is there a precedent of this approach succeeding elsewhere? -->

### Related files
<!-- Files related to this issue; this is super useful for new contributors who might want to help! If you're not sure, leave this blank; a maintainer will add them. -->

### Stakeholders
<!-- @ tag stakeholders of this bug -->



Discussion:
Looked into this briefly. Only the first author is passed to [templates/books/add.html](https://github.com/internetarchive/openlibrary/blob/6f755aee7115c668ae3ce078a4209ecd7a400cb5/openlibrary/templates/books/add.html#L39) from [upstream/addbook.py](https://github.com/internetarchive/openlibrary/blob/6f755aee7115c668ae3ce078a4209ecd7a400cb5/openlibrary/plugins/upstream/addbook.py#L201). If addbook is updated to pull all authors it should be enough since [templates/books/author-autocomplete.py](https://github.com/internetarchive/openlibrary/blob/6f755aee7115c668ae3ce078a4209ecd7a400cb5/openlibrary/templates/books/author-autocomplete.html#L28) is already attempting to render a list of authors.
@sbwhitt would you be open to trying this one out?
> @sbwhitt would you be open to trying this one out?

Yeah, absolutely! Shouldn't be too bad from what I saw. Also, would it be possible to get a link to the Slack server? Would like to get an idea of what the development focuses are at the moment. Thanks!

Resolving patch:
diff --git a/openlibrary/plugins/upstream/addbook.py b/openlibrary/plugins/upstream/addbook.py
--- a/openlibrary/plugins/upstream/addbook.py
+++ b/openlibrary/plugins/upstream/addbook.py
@@ -193,12 +193,14 @@ def GET(self):
         if not self.has_permission():
             return safe_seeother(f"/account/login?redirect={self.path}")
 
-        i = web.input(work=None, author=None)
+        i = web.input(work=None)
         work = i.work and web.ctx.site.get(i.work)
-        author = i.author and web.ctx.site.get(i.author)
+        authors = (work and work.authors) or []
+        if work and authors:
+            authors = [a.author for a in authors]
 
         return render_template(
-            'books/add', work=work, author=author, recaptcha=get_recaptcha()
+            'books/add', work=work, authors=authors, recaptcha=get_recaptcha()
         )
 
     def has_permission(self) -> bool:


Test patch: