Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 22, 2025

Technical

Librarians need to see archive.org identifiers for metadata verification and curation, even when books aren't open or lendable. Commit 278fd34 hid the ocaid based on availability, breaking this workflow.

Modified openlibrary/templates/type/edition/view.html line 454 to show Internet Archive identifier in Edition Identifiers section when user is librarian or admin:

$if identifier_label != "Internet Archive" or is_viewable_book or is_librarian or (ctx.user and ctx.user.is_admin()):

Reuses existing is_librarian variable. Regular users unchanged—still requires viewable book.

Testing

  1. As librarian/admin: view book with ocaid that is not open/lendable
  2. Verify Internet Archive identifier appears in Edition Identifiers section
  3. As regular user: verify identifier still hidden for non-viewable books

Screenshot

N/A - template-only change, requires local/staging environment with librarian credentials

Stakeholders

@mekarpeles

Original prompt

This section details on the original issue you should resolve

<issue_title>As a Librarian it would still be useful to see the archive.org link when a book is not open or lendable</issue_title>
<issue_description>### Feature Request

Problem / Opportunity

This commit hid the ocaid value based on availability results:
278fd34

As a Librarian checking and following the metadata is important, so it'd be helpful to still see the identifiers in the UI, at least for that usergroup.

Motivation: I modified the linked archive.org identifier for this item: https://openlibrary.org/books/OL6724732M/Thyroxine
from a printdisabled to an open edition (1929, public domain), and the identifier still didn't show up under Edition Identifiers as I expected. Is this a bug, or just the availability API being slow to catch up through cached values?

Proposal

Breakdown

Related files

Refer to this map of common Endpoints:
*

Requirements Checklist

Checklist of requirements that need to be satisfied in order for this issue to be closed:

  • [ ]

Stakeholders


Instructions for Contributors

  • Before creating a new branch or pushing up changes to a PR, please first run these commands to ensure your repository is up to date, as the pre-commit bot may add commits to your PRs upstream.
    </issue_description>

<agent_instructions>See commit 278fd34. Please modify openlibrary/templates/type/edition/view so that if the user has librarian permissionsor admin they can see the ocaid / internet archive identifier.

This pull request doesn't need extensive testing, etc, but should pass basic linting.

You should be able to do something like

$if ctx.user and ((ctx.user.is_librarian() or ctx.user.is_admin())):

</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 22, 2025 15:12
- Modified view.html to display ocaid in Edition Identifiers section
- Allows librarians and admins to see the archive.org link even when
  a book is not open or lendable
- Maintains existing behavior for regular users

Co-authored-by: mekarpeles <[email protected]>
- Use existing is_librarian variable instead of inline check
- Cleaner condition that's easier to read
- Maintains same functionality

Co-authored-by: mekarpeles <[email protected]>
Copilot AI changed the title [WIP] Add archive.org link visibility for librarians Show Internet Archive identifier to librarians and admins for non-viewable books Dec 22, 2025
Copilot AI requested a review from mekarpeles December 22, 2025 15:18
@mekarpeles mekarpeles marked this pull request as ready for review December 24, 2025 15:24
Copilot AI review requested due to automatic review settings December 24, 2025 15:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR restores visibility of Internet Archive identifiers to librarians and admins for non-viewable books, fixing a regression introduced in commit 278fd34 that hid these identifiers based solely on book availability.

Key Changes

  • Modified the conditional check in the Edition Identifiers section to allow librarians and admins to see Internet Archive identifiers regardless of book viewability status
  • Regular users continue to only see Internet Archive identifiers for viewable books

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hornc
Copy link
Collaborator

hornc commented Dec 26, 2025

LGTM

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.

As a Librarian it would still be useful to see the archive.org link when a book is not open or lendable

3 participants