Skip to content

Commit

Permalink
Fix "Add to Collection" for page 2+ of works
Browse files Browse the repository at this point in the history
Prior to this commit, when you were on page 2 of your works and selected
a work to add to a collection, the query for available collections would
use the page 2 as part of the collection query. This would mean the
first 100 collections (default page size) that you had access to add
works to were skipped.

With this commit, we omit the query parameters from the works page and
then query collections.
  • Loading branch information
laritakr committed Nov 27, 2023
1 parent f6109d4 commit ea36e92
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions app/controllers/hyrax/my/works_controller_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

##
# OVERRIDE Hyrax 3.5.0; when Hyrax hits v4.0.0 we can remove this.
# @see https://github.com/samvera/hyrax/pull/5972
module Hyrax
module My
module WorksControllerDecorator

private

def collections_service
cloned = clone
cloned.params = {}
Hyrax::CollectionsService.new(cloned)
end
end
end
end

Hyrax::My::WorksController.prepend(Hyrax::My::WorksControllerDecorator)

0 comments on commit ea36e92

Please sign in to comment.