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

Stop silently deleting primary DOIs #1761

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions app/controllers/stash_datacite/publications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,9 @@ def save_doi

related_dois.each do |rd|
bare_related_doi = Stash::Import::Crossref.bare_doi(doi_string: rd.related_identifier)
return nil if bare_related_doi.include?(bare_form_doi) # user is entering a DOI that we already have
next unless bare_form_doi.include? bare_related_doi
next unless bare_form_doi.include?(bare_related_doi) || bare_related_doi.include?(bare_form_doi) # user is entering a DOI that we already have

standard_doi = RelatedIdentifier.standardize_doi(bare_form_doi)

# user is expanding on a DOI that we already have; update it in the DB (and change the work_type if needed)
rd.update(related_identifier: standard_doi, related_identifier_type: 'doi', work_type: 'primary_article',
hidden: false)
Expand Down