Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix author not pre-filling on new work #8431

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

sbwhitt
Copy link
Collaborator

@sbwhitt sbwhitt commented Oct 18, 2023

Closes #8422

Prefills author name on add book page when adding a new work from the author page.

Technical

Testing

Go to an author's page. Select 'Add another?'. Verify that the author's name is already included in the author field for the new work.

Screenshot

Stakeholders

@mheiman @lephemere

authors = (work and work.authors) or []
if work and authors:
authors = [a.author for a in authors]
# pre-filling existing author if adding new work from author page
if author and author not in authors:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could potentially leverage some of the work from https://github.com/internetarchive/openlibrary/blob/master/openlibrary/catalog/add_book/__init__.py#L801-L802 where we normalize/dedupe authors on import... But I think this PR is good for now!

@mekarpeles mekarpeles merged commit 6f4af90 into internetarchive:master Oct 18, 2023
3 checks passed
@mekarpeles mekarpeles self-assigned this Oct 18, 2023
@mekarpeles
Copy link
Member

mekarpeles commented Oct 18, 2023

lgtm, ty @sbwhitt!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prefill author name when adding work from author page
2 participants