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

Allow GrantEditToMembersJob to receive either an AF object or a Valkyrie resource as the Work #4101

Closed
elrayle opened this issue Oct 21, 2019 · 1 comment
Assignees
Labels

Comments

@elrayle
Copy link
Contributor

elrayle commented Oct 21, 2019

Descriptive summary

Convert GrantEditToMembersJob to allow it to receive either an ActiveFedora based FileSet or a Valkyrie::Resource equivalent Work.

Rationale

Allow jobs to execute correctly with existing AF implementation or the wings Valkyrie implementation.

Expected behavior

GrantEditToMembersJob receives a Valkyrie::Resource and performs GrantEditJob for each member FileSet.

To get the list of FileSet ids from a work resource, use...

file_set_ids = Hyrax.query_service.custom_queries.find_child_fileset_ids(resource: work_resource)

Coordinate with Issue #4104 to pass use_valkyrie: true when a Valkyrie::Resource was received and false if not.

Actual behavior

GrantEditToMembersJob raises an exception (perhaps: NoMethodFound for #search_with_conditions) when passed a Valkyrie::Resource.

Approach for Conversion

See Pattern for Jobs Receiving Parameter that may be an AF Object or a Valkyrie Resource

Steps to reproduce the behavior

  1. Need to add tests that validate that the same tests pass whether a Valkyrie::Resource or an AF object is passed.

See example of processing both objects in... file_set_actor_spec.rb

For testing this job, you can use something like...

RSpec.describe GrantEditToMembersJob do
  [true, false].each do |test_valkyrie|
    context "when test_valkyrie is #{test_valkyrie}" do
      let(:af_work) { create(:work) }
      let(:valk_file_set) { af_work.valkyrie_resource }
      let(:work) { test_valkyrie ? valk_file_set : af_work }

Related work

@elrayle
Copy link
Contributor Author

elrayle commented Oct 25, 2019

Fixed by PR #4123

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants