Skip to content

Commit

Permalink
Merge pull request samvera#4809 from samvera/uri-to-id
Browse files Browse the repository at this point in the history
remove several (indirect) ActiveFedora calls
  • Loading branch information
jeremyf authored Mar 18, 2021
2 parents d3a2660 + d80007a commit e21dc43
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/services/hyrax/adapters/nesting_index_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def self.find_index_document_by(id:)
# @see Samvera::NestingIndexer.reindex_all!(extent: FULL_REINDEX)
def self.each_perservation_document_id_and_parent_ids(&block) # rubocop:disable Lint/UnusedMethodArgument
ActiveFedora::Base.descendant_uris(ActiveFedora.fedora.base_uri, exclude_uri: true).each do |uri|
id = Hyrax::Base.uri_to_id(uri)
id = Hyrax.config.translate_uri_to_id.call(uri)
object = ActiveFedora::Base.find(id)
parent_ids = object.try(:member_of_collection_ids) || []

Expand Down
2 changes: 1 addition & 1 deletion app/services/hyrax/graph_exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def clean_graph_repository
# This method is called once for each statement in the graph.
def replacer
lambda do |resource_id, _graph|
parent_id = Hyrax::Base.uri_to_id(parent_url)
parent_id = Hyrax.config.translate_uri_to_id.call(parent_url)
return parent_url + resource_id.sub(parent_id, '') if resource_id.start_with?(parent_id)
Rails.application.routes.url_helpers.solr_document_url(resource_id, host: hostname)
end
Expand Down
2 changes: 1 addition & 1 deletion app/services/hyrax/versioning_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def latest_version_of(file)
def versioned_file_id(file)
versions = file.versions.all
if versions.present?
Hyrax::Base.uri_to_id(versions.last.uri)
Hyrax.config.translate_uri_to_id.call(versions.last.uri)
else
file.id
end
Expand Down

0 comments on commit e21dc43

Please sign in to comment.