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 admin set valkyrie create #5240

Merged
merged 2 commits into from
Nov 2, 2021
Merged

Fix admin set valkyrie create #5240

merged 2 commits into from
Nov 2, 2021

Conversation

elrayle
Copy link
Contributor

@elrayle elrayle commented Nov 2, 2021

The valkyrie_create! method was passing the original admin_set toHyrax::Collections::PermissionsCreateService.create_default. This works for ActiveFedora because it updates the original admin_set during save. For valkyrie, the original admin_set does not have a value for id after it is persisted. It needs to pass the results of Hyrax.persister.save which is the updated admin_set that does have a value for id.

Expected

Create the new admin set and associated permission template without errors.

Actual

Creates the new admin set, but gets an error when creating the permission template.

     RSolr::Error::Http:
       RSolr::Error::Http - 400 Bad Request
       Error: {
         "responseHeader":{
           "status":400,
           "QTime":1},
         "error":{
           "metadata":[
             "error-class","org.apache.solr.common.SolrException",
             "root-error-class","org.apache.solr.common.SolrException"],
           "msg":"Document is missing mandatory uniqueKey field: id",
           "code":400}}

To reproduce:

Run the following test with the first commit that adds the test, but not the fix.

bundle exec rspec spec/services/hyrax/admin_set_create_service_spec.rb:157

@samvera/hyrax-code-reviewers

@@ -147,7 +147,8 @@
.to receive(:available_workflows).and_return(available_workflows)
allow(Sipity::Workflow)
.to receive(:activate!)
.with(permission_template: kind_of(Hyrax::PermissionTemplate), workflow_name: Hyrax.config.default_active_workflow_name)
.with(permission_template: kind_of(Hyrax::PermissionTemplate),
workflow_name: Hyrax.config.default_active_workflow_name)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This just adds a new line return for readability.

Copy link
Member

@cjcolvar cjcolvar left a comment

Choose a reason for hiding this comment

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

Good catch!

@elrayle elrayle merged commit 97f4560 into main Nov 2, 2021
@elrayle elrayle deleted the fix_admin_set_valkyrie_create branch November 2, 2021 17:46
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.

2 participants