Repository: internetarchive/openlibrary

Issue:
Add generalized de-dupe function for ISBN and LCCN for edit edition form
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

### Describe the problem that you'd like solved
<!-- A clear and concise description of what you want to happen. -->
After completion of #8092, was asked to generalize the current duplication checking for the edit edition page so it can be used by any identifier type. Currently there is a separate function doing the same thing for [ISBN](https://github.com/internetarchive/openlibrary/blob/8f0b4b4a81335ee0bc32eed23dc71931af8e12fc/openlibrary/plugins/openlibrary/js/edit.js#L92) and [LCCN](https://github.com/internetarchive/openlibrary/blob/8f0b4b4a81335ee0bc32eed23dc71931af8e12fc/openlibrary/plugins/openlibrary/js/edit.js#L103).

### Proposal & Constraints
<!-- What is the proposed solution / implementation? Is there a precedent of this approach succeeding elsewhere? -->
A single de-dupe function placed in the newly created [idValidation.js](https://github.com/internetarchive/openlibrary/blob/master/openlibrary/plugins/openlibrary/js/idValidation.js) that would accept any identifier entry.

<!-- Which suggestions or requirements should be considered for how feature needs to appear or be implemented? -->

### Additional context
<!-- Add any other context or screenshots about the feature request here. -->
Kept separate from #8235 to allow the original PR to be merged quicker.

### Stakeholders
<!-- @ tag stakeholders of this bug -->
@scottbarnes 





Discussion:

Resolving patch:
diff --git a/openlibrary/plugins/upstream/models.py b/openlibrary/plugins/upstream/models.py
--- a/openlibrary/plugins/upstream/models.py
+++ b/openlibrary/plugins/upstream/models.py
@@ -332,7 +332,6 @@ def set_identifiers(self, identifiers):
             if name == 'lccn':
                 value = normalize_lccn(value)
             # `None` in this field causes errors. See #7999.
-            # We should surface to the patron that an invalid LCCN is dropped. See #8092.
             if value is not None:
                 d.setdefault(name, []).append(value)
 


Test patch:
diff --git a/tests/unit/js/html-test-data.js b/tests/unit/js/html-test-data.js
--- a/tests/unit/js/html-test-data.js
+++ b/tests/unit/js/html-test-data.js
@@ -4,7 +4,7 @@ export const editionIdentifiersSample = `
     &quot;You need to give a value to ID.&quot;: &quot;You need to give a value to ID.&quot;,
     &quot;ID ids cannot contain whitespace.&quot;: &quot;ID ids cannot contain whitespace.&quot;,
     &quot;ID must be exactly 10 characters [0-9] or X.&quot;: &quot;ID must be exactly 10 characters [0-9] or X.&quot;,
-    &quot;That ISBN already exists for this edition.&quot;: &quot;That ISBN already exists for this edition.&quot;,
+    &quot;That ID already exists for this edition.&quot;: &quot;That ID already exists for this edition.&quot;,
     &quot;ID must be exactly 13 digits [0-9]. For example: 978-1-56619-909-4&quot;: &quot;ID must be exactly 13 digits [0-9]. For example: 978-1-56619-909-4&quot;,
     &quot;Invalid ID format&quot;: &quot;Invalid ID format&quot;
 }">