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(Identifier-Editor): Improve identifier editor behavior for ISBNs #832

Merged
merged 3 commits into from
Apr 6, 2022

Conversation

tr1ten
Copy link
Collaborator

@tr1ten tr1ten commented Apr 5, 2022

In this PR, I am making ISBN detection more strict by verifying its check digit, disabling switching type after user manually selected it and disabling new ISBN row addition(temporary).

@tr1ten tr1ten requested a review from MonkeyDo April 6, 2022 14:16
Copy link
Contributor

@MonkeyDo MonkeyDo left a comment

Choose a reason for hiding this comment

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

Thanks for woking on this !

I dug deeper this time (armed with more knowledge of ISBN peculiarities), and I don't think the ISBN10 validation is working properly
These valid ISBN 10 don't pass validation:
9783257862
0198526636
0306406152
1-250-03775-1 // 1250037751

At this point, instead of digging our own grave, let's revisit this and use an existing library to solve these issues of validation, conversion and formatting.
For example: https://github.com/inventaire/isbn3

I would suggest we do this:

  • Keep the commenting out of auto ISBN conversion
  • Keep the "don't change the identifier type if it is set"
  • Remove the ISBN check digit validation (not sure it's 100% working at the moment)

We'll be back to more or less the previous functionality (with the small improvement of not auto-selecting type if manually selected) which is what we want for a patch.

Then in a separate PR, we can work on improving the functionality using the third-party library, and spend more time testing everything instead of putting out fires :)

@@ -43,7 +43,8 @@ function reducer(
const updatedValue = state.setIn(
[payload.rowId, 'value'], payload.value
);
if (payload.suggestedType) {
// don't switch type if user already selected it
if (payload.suggestedType && !state.getIn([payload.rowId, 'type'])) {
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️ CatQuest is going to be very happy about this one !

Copy link
Contributor

@MonkeyDo MonkeyDo left a comment

Choose a reason for hiding this comment

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

Thank you !

@MonkeyDo MonkeyDo merged commit e0d5a39 into metabrainz:master Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants