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

Points Hyrax::EditPermissionsService.build_service_object_from to Hyrax configuration variable. #6768

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions app/services/hyrax/edit_permissions_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class EditPermissionsService
# * form_object.object.model = FileSet
# * use work the file_set is in
# No other object types are supported by this view.
def self.build_service_object_from(form:, ability:)
def self.build_service_object_from(form:, ability:) # rubocop:disable Metrics/AbcSize
if form.object.respond_to?(:model) && form.object.model.work?
# The provided form object is a work form.
new(object: form.object, ability: ability)
Expand All @@ -41,7 +41,7 @@ def self.build_service_object_from(form:, ability:)
# (+Hyrax::Forms::FileSetForm+), +:in_works_ids+ is prepopulated onto
# the form object itself. For +Hyrax::Forms::FileSetEditForm+, the
# +:in_works+ method is present on the wrapped +:model+.
if form.object.is_a?(Hyrax::Forms::FileSetForm)
if form.object.is_a?(Hyrax.config.file_set_form)
object_id = form.object.in_works_ids.first
new(object: Hyrax.query_service.find_by(id: object_id), ability: ability)
else
Expand All @@ -51,7 +51,7 @@ def self.build_service_object_from(form:, ability:)
# The provided form object is a FileSet.
new(object: form.object.in_works.first, ability: ability)
end
end
end # rubocop:enable Metrics/AbcSize

attr_reader :depositor, :unauthorized_collection_managers

Expand Down