Skip to content

Commit ac06ba9

Browse files
authored
Merge pull request #799 from notch8/staging
`staging` -> `main` 2026-10-09
2 parents 9766d97 + b2d6c92 commit ac06ba9

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# frozen_string_literal: true
2+
3+
# OVERRIDE blacklight_range_limit v8.5.0 to pin the "view distribution" link to the catalog.
4+
# Upstream resolves `action: 'range_limit'` against the current controller, so on the
5+
# homepage (heritage / cultural_repository themes render facets there) it looks for
6+
# hyrax/homepage#range_limit, which has no route, and the page 500s.
7+
# Same fix Hyku applies to `search_facet_path` in Hyrax::HomepageController.
8+
9+
module BlacklightRangeLimit
10+
module RangeFacetComponentDecorator
11+
def range_limit_url(options = {})
12+
super(options.merge(controller: '/catalog'))
13+
end
14+
end
15+
end
16+
17+
BlacklightRangeLimit::RangeFacetComponent.prepend(BlacklightRangeLimit::RangeFacetComponentDecorator)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# frozen_string_literal: true
2+
3+
RSpec.describe BlacklightRangeLimit::RangeFacetComponentDecorator do
4+
let(:controller) do
5+
Hyrax::HomepageController.new.tap do |c|
6+
c.request = ActionDispatch::TestRequest.create
7+
c.request.path_parameters = { controller: 'hyrax/homepage', action: 'index' }
8+
end
9+
end
10+
let(:search_state) { Blacklight::SearchState.new({}, CatalogController.blacklight_config, controller) }
11+
let(:facet_field) { double(key: 'date_range_isim', search_state:) }
12+
let(:component) do
13+
BlacklightRangeLimit::RangeFacetComponent.new(facet_field:).tap do |c|
14+
allow(c).to receive(:helpers).and_return(controller.helpers)
15+
end
16+
end
17+
18+
it 'reproduces the bug without the decorator' do
19+
upstream = BlacklightRangeLimit::RangeFacetComponent.instance_method(:range_limit_url).super_method
20+
expect { upstream.bind_call(component, range_start: 1900, range_end: 2000) }
21+
.to raise_error(ActionController::UrlGenerationError, /hyrax\/homepage/)
22+
end
23+
24+
it 'points the range_limit link at the catalog' do
25+
expect(component.range_limit_url(range_start: 1900, range_end: 2000))
26+
.to include('/catalog/range_limit').and include('range_field=date_range_isim')
27+
end
28+
end

0 commit comments

Comments
 (0)