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

Add custom Doi and Orcid structs and use them to warn of parsing errors as user types #249

Merged
merged 22 commits into from
Jun 21, 2021

Conversation

rhigman
Copy link
Member

@rhigman rhigman commented Jun 3, 2021

Fixes #233 and #136.

DOIs/ORCIDs are stored in database with the full standardised protocol/resource name (https://doi.org/ or https://orcid.org). For display in the client, the protocol/resource name are stripped. Editable DOI/ORCID fields are now prepended with a static button containing the standardised protocol/resource name as a prompt to the user.

Any entry in the field which can be successfully parsed (e.g. plain correctly constructed DOI/ORCID, DOI with doi.org/ prepended, ORCID with http://ORCiD.org/ prepended) is accepted and converted on save to the display version (i.e. with protocol/resource name stripped). While the field contains a non-parsable entry, a warning tooltip is displayed, and on save, the field reverts to the previous (i.e. stored) value.

Also added the wrapper type Timestamp for DateTime<Utc>, facilitated by the diesel-derive-newtype crate added for creation of the Doi/Orcid types, allowing custom defaults and more streamlined code.

thoth-api/src/model/mod.rs Outdated Show resolved Hide resolved
thoth-api/src/model/mod.rs Show resolved Hide resolved
thoth-api/src/graphql/model.rs Show resolved Hide resolved
thoth-app/src/component/work.rs Outdated Show resolved Hide resolved
thoth-api/src/model/mod.rs Outdated Show resolved Hide resolved
…entry of uppercased protocol/resource name letters (the only letter orcid identifiers can contain is uppercase X, and doi identifier constraints already explicitly specify both a-z and A-Z as acceptable)
thoth-api/src/errors.rs Outdated Show resolved Hide resolved
@rhigman rhigman requested a review from ja573 June 21, 2021 10:16
@rhigman
Copy link
Member Author

rhigman commented Jun 21, 2021

Changes following review include improving FormTextInputExtended logic (formerly FormTextInputTooltip) now that we are at Yew v0.18.0, as noted under #220 (where I said I'd make an issue to track it, but then forgot...)

ja573
ja573 previously approved these changes Jun 21, 2021
@rhigman
Copy link
Member Author

rhigman commented Jun 21, 2021

@ja573 In fixing merge conflicts, I added thoth-api back in as a dependency for thoth-export-server (which was removed under #256 ) - but that's only so that we can use thoth_api::model::DOI_DOMAIN in writing out Onix3ProjectMuse. Happy to remove this again and replace it with the inline string if we'd rather not have this unnecessary dependency.

@rhigman rhigman requested a review from ja573 June 21, 2021 13:57
@ja573
Copy link
Member

ja573 commented Jun 21, 2021

@ja573 In fixing merge conflicts, I added thoth-api back in as a dependency for thoth-export-server (which was removed under #256 ) - but that's only so that we can use thoth_api::model::DOI_DOMAIN in writing out Onix3ProjectMuse. Happy to remove this again and replace it with the inline string if we'd rather not have this unnecessary dependency.

No, that's fine - leave it there for the time being

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.

Validate DOI and ORCID in the client side Implement a DOI structure in API and APP
2 participants