openlibrary icon indicating copy to clipboard operation
openlibrary copied to clipboard

Adding multiple ocaid's in edit UI only adds one

Open mekarpeles opened this issue 9 years ago • 10 comments

Edit UI allows admin to add multiple ocaid's (archive.org ids) but only sets 1.

To reproduce

  1. Edit a book on local env (e.g. http://localhost:8080/books/OL2058361M/The_wit_wisdom_of_Mark_Twainsadf/edit
  2. Add 3 random IA ids
  3. Save.

Actual: Only the first IA id will persist; all others ignored. Expected: Support adding multiple OCAIDs.

Note it's not a requirement of this issue that the Read buttons query all OCAIDs, but we need a way to unblock imports of records like this.

Suggestion: add identifiers['ia'] that stores all OCAIDs, and leaves .ocaid for the "main" ocaid for backwards compat.

mekarpeles avatar Dec 02 '16 19:12 mekarpeles

@mekarpeles Is this still an issue? If so, are you willing to be assignee? Note: being assignee doesn't necessarily mean you are the one doing the work for the issue but responsible for collecting information needed to devise a solution. From the wiki:

At submission and prior to triage, the assigned owner is not necessarily the person who will fix the issue (it is not necessarily even established, at that point, if or when the issue will be fixed at all), but rather they are the person who will do as much or as little as needed to handle the issue (asking questions, soliciting input, establishing and updating the priority, checking if it is a duplicate, etc).

Once an issue is labeled State: Work In Progress, the owner is the individual doing the work, or leading/coordinating the group that is doing the work.

xayhewalo avatar Oct 22 '19 00:10 xayhewalo

(Confirmed this is still an issue)

cdrini avatar Nov 07 '19 21:11 cdrini

Assigning jdlrobson (not tagging by request) per slack discussion since it's UI related

xayhewalo avatar Nov 08 '19 03:11 xayhewalo

Edit UI allows admin to add multiple ocaid's (archive.org ids) but only sets 1. What edit id?

@cdrini or @mekarpeles can somebody expand the description so it's clear to someone who doesn't know how our project works what we want to fix here and how.

jdlrobson avatar Nov 08 '19 22:11 jdlrobson

@jdlrobson updated; does that look ok?

cdrini avatar Nov 09 '19 04:11 cdrini

Thank you @cdrini .perfect!

jdlrobson avatar Nov 09 '19 17:11 jdlrobson

@hornc this seems like it may have a front-end portion and a back-end portion, can we assign you as the Lead for this one?

mekarpeles avatar Dec 18 '19 00:12 mekarpeles

This can be fixed by adding something as simple as:

if (['ocaid'].includes(data.name) && document.getElementsByName("edition--identifiers--0--name").length === 1) {
    return error("#id-errors", "id-value", "$_('ID can only be used once per edition')".replace(/ID/, label));
}

However, before that happens, I believe the inline js should be moved from openlibrary/templates/books/edit/edition.html per #4474.

Additionally, if #5093 is merged then it would probably make sense to use that component and do validation in Vue.

RayBB avatar May 01 '21 07:05 RayBB

However, before that happens, I believe the inline js should be moved from openlibrary/templates/books/edit/edition.html per #4474.

Yep doing that first would be great (and that would include removal of the jsdef). It would also allow us to add a unit test. Is that something you'd be willing to help out with?

jdlrobson avatar May 01 '21 18:05 jdlrobson

@Eds-Dbug are you still interested in working on this? If so, let me know if you need any help :)

RayBB avatar Oct 06 '23 19:10 RayBB

ocaid is a single string value in current schema: https://github.com/internetarchive/openlibrary/blob/12d140f9bf8fe54018b1dc292ecdf9d5646843d1/openlibrary/schemata/edition.schema.json#L51C6-L56

hornc avatar Nov 12 '25 11:11 hornc

The bug here is with the UI not adhering to the schema; it presumably lets you add multiple IA IDs, which it shouldn't let you do. Dropping in priority though since adding IA identifiers is now restricted to accounts with elevated permissions.

cdrini avatar Nov 12 '25 15:11 cdrini

If this issue remains unresolved, no promises yet but I might pick it up.

On Wed, Nov 12, 2025 at 10:54 AM Drini Cami @.***> wrote:

cdrini left a comment (internetarchive/openlibrary#395) https://github.com/internetarchive/openlibrary/issues/395#issuecomment-3522559830

The bug here is with the UI not adhering to the schema; it presumably lets you add multiple IA IDs, which it shouldn't let you do. Dropping in priority though since adding IA identifiers is now restricted to accounts with elevated permissions.

— Reply to this email directly, view it on GitHub https://github.com/internetarchive/openlibrary/issues/395#issuecomment-3522559830, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT4EQGG244XDFNOXCNXB6IL34NJZVAVCNFSM6AAAAACL33LKJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKMRSGU2TSOBTGA . You are receiving this because you were mentioned.Message ID: @.***>

Eds-Dbug avatar Nov 14 '25 16:11 Eds-Dbug

@Eds-Dbug go for it!

RayBB avatar Nov 18 '25 01:11 RayBB