hyrax 5.1.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.dassie/Gemfile +1 -1
  3. data/.dassie/config/application.rb +1 -1
  4. data/.dassie/config/initializers/devise.rb +1 -0
  5. data/.dassie/db/schema.rb +110 -109
  6. data/.github/workflows/lint-build-test.yml +1 -1
  7. data/.koppie/config/initializers/devise.rb +1 -1
  8. data/CONTAINERS.md +10 -10
  9. data/Gemfile +2 -1
  10. data/app/controllers/concerns/hyrax/valkyrie_downloads_controller_behavior.rb +1 -0
  11. data/app/controllers/concerns/hyrax/works_controller_behavior.rb +2 -1
  12. data/app/controllers/hyrax/admin/analytics/work_reports_controller.rb +4 -4
  13. data/app/controllers/hyrax/file_sets_controller.rb +1 -1
  14. data/app/helpers/hyrax/hyrax_helper_behavior.rb +2 -2
  15. data/app/helpers/hyrax/trophy_helper.rb +1 -1
  16. data/app/jobs/concerns/hyrax/queued_job_behavior.rb +22 -0
  17. data/app/jobs/hyrax/propagate_change_depositor_job.rb +1 -1
  18. data/app/jobs/hyrax/queued_delete_job.rb +11 -0
  19. data/app/jobs/hyrax/queued_indexing_job.rb +11 -0
  20. data/app/jobs/migrate_files_to_valkyrie_job.rb +33 -21
  21. data/app/jobs/migrate_sipity_entity_job.rb +21 -0
  22. data/app/models/concerns/hyrax/ability.rb +4 -2
  23. data/app/models/concerns/hyrax/solr_document_behavior.rb +5 -2
  24. data/app/models/hyrax/file_metadata.rb +22 -7
  25. data/app/services/hyrax/analytics/ga4/base.rb +1 -1
  26. data/app/services/hyrax/analytics/ga4.rb +5 -1
  27. data/app/services/hyrax/change_depositor_service.rb +1 -1
  28. data/app/services/hyrax/characterization/valkyrie_characterization_service.rb +21 -13
  29. data/app/services/hyrax/custom_queries/find_ids_by_model.rb +31 -6
  30. data/app/services/hyrax/edit_permissions_service.rb +9 -8
  31. data/app/services/hyrax/workflow/workflow_factory.rb +3 -3
  32. data/app/services/migrate_resource_service.rb +1 -1
  33. data/app/views/_user_util_links.html.erb +2 -1
  34. data/app/views/hyrax/admin/analytics/collection_reports/_top_collections.html.erb +3 -7
  35. data/app/views/hyrax/admin/analytics/work_reports/_top_file_set_downloads.html.erb +3 -6
  36. data/app/views/hyrax/admin/analytics/work_reports/_top_works.html.erb +2 -3
  37. data/app/views/hyrax/admin/analytics/work_reports/_work_files.html.erb +1 -6
  38. data/app/views/hyrax/base/_social_media.html.erb +2 -0
  39. data/app/views/hyrax/dashboard/collections/_show_document_list_menu.html.erb +13 -12
  40. data/app/views/hyrax/my/_admin_set_action_menu.html.erb +31 -27
  41. data/app/views/hyrax/my/_collection_action_menu.html.erb +40 -35
  42. data/app/views/hyrax/my/_work_action_menu.html.erb +23 -22
  43. data/config/features.rb +50 -40
  44. data/config/initializers/indexing_adapter_initializer.rb +4 -0
  45. data/config/initializers/new_framework_defaults_7_2.rb +6 -4
  46. data/config/initializers/reform_rails_6_1_monkey_patch.rb +29 -0
  47. data/config/metadata/core_metadata.yaml +1 -0
  48. data/docker-compose-dassie.yml +4 -4
  49. data/documentation/developing-your-hyrax-based-app.md +2 -2
  50. data/hyrax.gemspec +2 -2
  51. data/lib/freyja/persister.rb +11 -4
  52. data/lib/hyrax/configuration.rb +22 -7
  53. data/lib/hyrax/controlled_vocabulary/importer/language.rb +5 -1
  54. data/lib/hyrax/transactions/steps/add_file_sets.rb +2 -1
  55. data/lib/hyrax/version.rb +1 -1
  56. data/lib/hyrax.rb +1 -0
  57. data/lib/valkyrie/indexing/redis_queue/indexing_adapter.rb +144 -0
  58. data/lib/wings/valkyrie/query_service.rb +3 -4
  59. data/template.rb +1 -1
  60. metadata +20 -12
  61. data/.github/workflows/main.yml +0 -17
@@ -14,8 +14,8 @@
14
14
  <tbody>
15
15
  <% @top_file_set_downloads.each do |download| %>
16
16
  <tr>
17
- <td><%= download[1] %></td>
18
- <td><%= download[0] %></td>
17
+ <td><%= download[1] %></td>
18
+ <td><%= download[0] %></td>
19
19
  <td><%= download[2] %></td>
20
20
  </tr>
21
21
  <% end %>
@@ -24,10 +24,7 @@
24
24
  </div>
25
25
  <div class="card-footer">
26
26
  <div class="float-right">
27
- <%= paginate @top_file_set_downloads %>
27
+ <%= paginate @top_file_set_downloads, outer_window: 2, theme: 'blacklight' %>
28
28
  </div>
29
29
  </div>
30
30
  </div>
31
-
32
-
33
-
@@ -24,16 +24,15 @@
24
24
  <td><%= work[0] %></td>
25
25
  <td><%= work[2] %></td>
26
26
  <td><%= work[3] %></td>
27
- </tr>
27
+ </tr>
28
28
  <% end %>
29
29
  </tbody>
30
30
  </table>
31
31
  </div>
32
-
33
32
 
34
33
  <div class="card-footer">
35
34
  <div class="float-right">
36
- <%= paginate @top_works %>
35
+ <%= paginate @top_works, outer_window: 2, theme: 'blacklight' %>
37
36
  </div>
38
37
  </div>
39
38
 
@@ -30,12 +30,7 @@
30
30
  </div>
31
31
  <div class="card-footer">
32
32
  <div class="float-right">
33
- <%= paginate @files %>
33
+ <%= paginate @files, outer_window: 2, theme: 'blacklight' %>
34
34
  </div>
35
35
  </div>
36
36
  </div>
37
-
38
-
39
-
40
-
41
-
@@ -1,3 +1,5 @@
1
+ <% return '' if Flipflop.hide_social_buttons? %>
2
+
1
3
  <% page_title ||= content_for?(:page_title) ? content_for(:page_title) : default_page_title %>
2
4
  <% share_url ||= request.original_url %>
3
5
  <div class="social-media">
@@ -1,21 +1,22 @@
1
1
  <div class="btn-group">
2
2
  <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><%= t('.select') %> <span class="caret"></span>
3
3
  </button>
4
- <ul class="dropdown-menu dropdown-menu-right">
4
+ <ul class="dropdown-menu dropdown-menu-right" role="menu">
5
5
  <% if can?( :edit, document ) && !workflow_restriction?(@presenter) %>
6
- <li class="dropdown-item">
7
- <%= link_to [main_app, :edit, document],
8
- class: "itemicon itemedit",
9
- title: t('hyrax.collection.document_list.edit'),
10
- id: "edit_work_link_#{document.id}" do %>
6
+ <%= link_to [main_app, :edit, document],
7
+ class: "itemicon itemedit",
8
+ role: 'menuitem',
9
+ title: t('hyrax.collection.document_list.edit'),
10
+ id: "edit_work_link_#{document.id}" do %>
11
+ <li class="dropdown-item">
11
12
  <i class="fa fa-pencil" aria-hidden="true"></i> <%= t('hyrax.collection.document_list.edit') %>
12
- <% end %>
13
- </li>
13
+ </li>
14
+ <% end %>
14
15
  <% end %>
15
- <li class="dropdown-item">
16
- <%= display_trophy_link(current_user, document.id) do |text| %>
16
+ <%= display_trophy_link(current_user, document.id, role: 'menuitem') do |text| %>
17
+ <li class="dropdown-item">
17
18
  <i class="fa fa-star" aria-hidden="true"></i> <%= text %>
18
- <% end %>
19
- </li>
19
+ </li>
20
+ <% end %>
20
21
  </ul>
21
22
  </div>
@@ -7,39 +7,43 @@
7
7
  <%= t("hyrax.dashboard.my.action.select") %>
8
8
  </button>
9
9
  <ul role="menu" id="<%= ul_id %>" class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenu_<%= id %>">
10
- <li class="dropdown-item" role="menuitem" tabindex="-1">
11
- <%= link_to hyrax.admin_admin_set_path(id),
12
- class: 'itemicon itemedit',
13
- title: t("hyrax.dashboard.my.action.view_admin_set") do %>
10
+ <%= link_to hyrax.admin_admin_set_path(id),
11
+ class: 'itemicon itemedit',
12
+ role: 'menuitem',
13
+ title: t("hyrax.dashboard.my.action.view_admin_set") do %>
14
+ <li class="dropdown-item" tabindex="-1">
14
15
  <%= t("hyrax.dashboard.my.action.view_admin_set") %>
15
- <% end %>
16
- </li>
16
+ </li>
17
+ <% end %>
17
18
  <% if can? :edit, admin_set_presenter.solr_document %>
18
- <li class="dropdown-item" role="menuitem" tabindex="-1">
19
- <%= link_to hyrax.edit_admin_admin_set_path(id),
20
- class: 'itemicon itemedit',
21
- title: t("hyrax.dashboard.my.action.edit_admin_set") do %>
19
+ <%= link_to hyrax.edit_admin_admin_set_path(id),
20
+ class: 'itemicon itemedit',
21
+ role: 'menuitem',
22
+ title: t("hyrax.dashboard.my.action.edit_admin_set") do %>
23
+ <li class="dropdown-item" tabindex="-1">
22
24
  <%= t("hyrax.dashboard.my.action.edit_admin_set") %>
23
- <% end %>
24
- </li>
25
+ </li>
26
+ <% end %>
25
27
  <% else %>
26
- <li class="dropdown-item" role="menuitem" tabindex="-1">
27
- <%= link_to "#",
28
- class: 'itemicon itemedit edit-collection-deny-button',
29
- title: t("hyrax.dashboard.my.action.edit_collection") do %>
28
+ <%= link_to "#",
29
+ class: 'itemicon itemedit edit-collection-deny-button',
30
+ role: 'menuitem',
31
+ title: t("hyrax.dashboard.my.action.edit_collection") do %>
32
+ <li class="dropdown-item" tabindex="-1">
30
33
  <%= t("hyrax.dashboard.my.action.edit_collection") %>
31
- <% end %>
32
- </li>
34
+ </li>
35
+ <% end %>
33
36
  <% end %>
34
- <li class="dropdown-item" role="menuitem" tabindex="-1">
35
- <%= link_to "#",
36
- class: 'itemicon itemtrash delete-collection-button',
37
- title: t("hyrax.dashboard.my.action.delete_admin_set"),
38
- data: { totalitems: admin_set_presenter.total_items ,
39
- membership: admin_set_presenter.collection_type_is_require_membership? ,
40
- hasaccess: (can?(:edit, admin_set_presenter.solr_document)) } do %>
37
+ <%= link_to "#",
38
+ class: 'itemicon itemtrash delete-collection-button',
39
+ role: 'menuitem',
40
+ title: t("hyrax.dashboard.my.action.delete_admin_set"),
41
+ data: { totalitems: admin_set_presenter.total_items,
42
+ membership: admin_set_presenter.collection_type_is_require_membership?,
43
+ hasaccess: (can?(:edit, admin_set_presenter.solr_document)) } do %>
44
+ <li class="dropdown-item" tabindex="-1">
41
45
  <%= t("hyrax.dashboard.my.action.delete_admin_set") %>
42
- <% end %>
43
- </li>
46
+ </li>
47
+ <% end %>
44
48
  </ul>
45
49
  </div>
@@ -7,52 +7,57 @@
7
7
  <%= t("hyrax.dashboard.my.action.select") %>
8
8
  </button>
9
9
  <ul role="menu" id="<%= ul_id %>" class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenu_<%= id %>">
10
- <li class="dropdown-item" role="menuitem" tabindex="-1">
11
- <%= link_to hyrax.dashboard_collection_path(id),
12
- class: 'itemicon itemedit',
13
- title: t("hyrax.dashboard.my.action.view_collection") do %>
10
+ <%= link_to hyrax.dashboard_collection_path(id),
11
+ class: 'itemicon itemedit',
12
+ role: 'menuitem',
13
+ title: t("hyrax.dashboard.my.action.view_collection") do %>
14
+ <li class="dropdown-item" tabindex="-1">
14
15
  <%= t("hyrax.dashboard.my.action.view_collection") %>
15
- <% end %>
16
- </li>
16
+ </li>
17
+ <% end %>
17
18
  <% if can? :edit, collection_presenter.solr_document %>
18
- <li class="dropdown-item" role="menuitem" tabindex="-1">
19
- <%= link_to hyrax.edit_dashboard_collection_path(id),
20
- class: 'itemicon itemedit',
21
- title: t("hyrax.dashboard.my.action.edit_collection") do %>
19
+ <%= link_to hyrax.edit_dashboard_collection_path(id),
20
+ class: 'itemicon itemedit',
21
+ role: 'menuitem',
22
+ title: t("hyrax.dashboard.my.action.edit_collection") do %>
23
+ <li class="dropdown-item" tabindex="-1">
22
24
  <%= t("hyrax.dashboard.my.action.edit_collection") %>
23
- <% end %>
24
- </li>
25
+ </li>
26
+ <% end %>
25
27
  <% else %>
26
- <li class="dropdown-item" role="menuitem" tabindex="-1">
27
- <%= link_to "#",
28
- class: 'itemicon itemedit edit-collection-deny-button',
29
- title: t("hyrax.dashboard.my.action.edit_collection") do %>
28
+ <%= link_to "#",
29
+ class: 'itemicon itemedit edit-collection-deny-button',
30
+ role: 'menuitem',
31
+ title: t("hyrax.dashboard.my.action.edit_collection") do %>
32
+ <li class="dropdown-item" tabindex="-1">
30
33
  <%= t("hyrax.dashboard.my.action.edit_collection") %>
31
- <% end %>
32
- </li>
34
+ </li>
35
+ <% end %>
33
36
  <% end %>
34
- <li class="dropdown-item" role="menuitem" tabindex="-1">
35
- <%= link_to "#",
36
- class: 'itemicon itemtrash delete-collection-button',
37
- title: t("hyrax.dashboard.my.action.delete_collection"),
38
- data: { totalitems: collection_presenter.total_items ,
39
- membership: collection_presenter.collection_type_is_require_membership? ,
40
- hasaccess: (can?(:edit, collection_presenter.solr_document)) } do %>
37
+ <%= link_to "#",
38
+ class: 'itemicon itemtrash delete-collection-button',
39
+ role: 'menuitem',
40
+ title: t("hyrax.dashboard.my.action.delete_collection"),
41
+ data: { totalitems: collection_presenter.total_items ,
42
+ membership: collection_presenter.collection_type_is_require_membership? ,
43
+ hasaccess: (can?(:edit, collection_presenter.solr_document)) } do %>
44
+ <li class="dropdown-item" tabindex="-1">
41
45
  <%= t("hyrax.dashboard.my.action.delete_collection") %>
42
- <% end %>
43
- </li>
46
+ </li>
47
+ <% end %>
44
48
 
45
49
  <% if collection_presenter.collection_type_is_nestable? %>
46
50
  <% # The user should have deposit access to the parent we are adding, and read access to the child (the collection we are linking here). %>
47
- <li class="dropdown-item" role="menuitem" tabindex="-1">
48
- <%= link_to "#",
49
- class: 'itemicon add-to-collection',
50
- title: t("hyrax.dashboard.my.action.add_to_collection"),
51
- data: { nestable: collection_presenter.collection_type_is_nestable? ,
52
- hasaccess: (can?(:read, collection_presenter.solr_document)) } do %>
51
+ <%= link_to "#",
52
+ class: 'itemicon add-to-collection',
53
+ role: 'menuitem',
54
+ title: t("hyrax.dashboard.my.action.add_to_collection"),
55
+ data: { nestable: collection_presenter.collection_type_is_nestable? ,
56
+ hasaccess: (can?(:read, collection_presenter.solr_document)) } do %>
57
+ <li class="dropdown-item" tabindex="-1">
53
58
  <%= t("hyrax.dashboard.my.action.add_to_collection") %>
54
- <% end %>
55
- </li>
59
+ </li>
60
+ <% end %>
56
61
  <% end %>
57
62
  </ul>
58
63
  </div>
@@ -8,38 +8,39 @@
8
8
  </button>
9
9
 
10
10
  <ul role="menu" id="<%= ul_id %>" class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenu_<%= document.id %>">
11
-
12
11
  <% if can? :edit, document.id %>
13
- <li class="dropdown-item" role="menuitem" tabindex="-1">
14
- <%= link_to [main_app, :edit, document],
15
- id: 'action-edit-work' do %>
12
+ <%= link_to [main_app, :edit, document],
13
+ id: 'action-edit-work', role: 'menuitem' do %>
14
+ <li class="dropdown-item" tabindex="-1">
16
15
  <%= t("hyrax.dashboard.my.action.edit_work") %>
17
- <% end %>
18
- </li>
16
+ </li>
17
+ <% end %>
19
18
 
20
- <li class="dropdown-item" role="menuitem" tabindex="-1">
21
- <%= link_to [main_app, document],
22
- method: :delete,
23
- id: 'action-delete-work',
24
- data: {
25
- confirm: t("hyrax.dashboard.my.action.work_confirmation", application_name: application_name) } do %>
19
+ <%= link_to [main_app, document],
20
+ method: :delete,
21
+ id: 'action-delete-work',
22
+ role: 'menuitem',
23
+ data: {
24
+ confirm: t("hyrax.dashboard.my.action.work_confirmation", application_name: application_name) } do %>
25
+ <li class="dropdown-item" tabindex="-1">
26
26
  <%= t("hyrax.dashboard.my.action.delete_work") %>
27
- <% end %>
28
- </li>
27
+ </li>
28
+ <% end %>
29
29
  <% end %>
30
30
 
31
- <li class="dropdown-item" role="menuitem" tabindex="-1">
32
- <%= display_trophy_link(current_user, document.id) do |text| %>
31
+ <%= display_trophy_link(current_user, document.id, role: 'menuitem' ) do |text| %>
32
+ <li class="dropdown-item" tabindex="-1">
33
33
  <%= text %>
34
- <% end %>
35
- </li>
34
+ </li>
35
+ <% end %>
36
36
 
37
37
  <% if can? :transfer, document.id %>
38
- <li class="dropdown-item" role="menuitem" tabindex="-1">
39
- <%= link_to(hyrax.new_work_transfer_path(document.id), id: 'action-transfer-work', class: 'itemicon itemtransfer', title: t("hyrax.dashboard.my.action.transfer")) do %>
38
+ <%= link_to(hyrax.new_work_transfer_path(document.id), id: 'action-transfer-work', role: 'menuitem',
39
+ class: 'itemicon itemtransfer', title: t("hyrax.dashboard.my.action.transfer")) do %>
40
+ <li class="dropdown-item" tabindex="-1">
40
41
  <%= t("hyrax.dashboard.my.action.transfer") %>
41
- <% end %>
42
- </li>
42
+ </li>
43
+ <% end %>
43
44
  <% end %>
44
45
  </ul>
45
46
  </div>
data/config/features.rb CHANGED
@@ -6,46 +6,56 @@ Flipflop.configure do
6
6
  strategy Hyrax::Strategies::YamlStrategy, config: Hyrax.config.feature_config_path
7
7
  strategy :default
8
8
 
9
- feature :proxy_deposit,
10
- default: true,
11
- description: "Depositors may designate proxies to deposit works on their behalf"
12
-
13
- feature :transfer_works,
14
- default: true,
15
- description: "Depositors may transfer their works to another user"
16
-
17
- # Note, if this is deactivated, a default admin set will be created and all
18
- # works will be assigned to it when they are created.
19
- feature :assign_admin_set,
20
- default: true,
21
- description: "Ability to assign uploaded items to an admin set"
22
-
23
- feature :show_deposit_agreement,
24
- default: true,
25
- description: "Show a deposit agreement to users creating works"
26
-
27
- feature :active_deposit_agreement_acceptance,
28
- default: Hyrax.config.active_deposit_agreement_acceptance?,
29
- description: "Require an active acceptance of the deposit agreement by checking a checkbox"
30
-
31
- feature :batch_upload,
32
- default: false,
33
- description: "Enable uploading batches of works"
34
-
35
- feature :hide_private_items,
36
- default: false,
37
- description: "Do not show the private items."
38
-
39
- feature :hide_users_list,
40
- default: true,
41
- description: "Do not show users list unless user has authenticated."
42
-
43
- feature :cache_work_iiif_manifest,
44
- default: false,
45
- description: "Use Rails.cache to cache the JSON document for IIIF manifests"
46
- feature :read_only,
47
- default: false,
48
- description: "Put the system into read-only mode. Deposits, edits, approvals and anything that makes a change to the data will be disabled."
9
+ group :site_configuration do
10
+ feature :cache_work_iiif_manifest,
11
+ default: false,
12
+ description: "Use Rails.cache to cache the JSON document for IIIF manifests"
13
+
14
+ feature :hide_private_items,
15
+ default: false,
16
+ description: "Do not show the private items."
17
+
18
+ feature :hide_social_buttons,
19
+ default: false,
20
+ description: "Do not show social media share buttons."
21
+
22
+ feature :hide_users_list,
23
+ default: true,
24
+ description: "Do not show users list unless user has authenticated."
25
+
26
+ feature :read_only,
27
+ default: false,
28
+ description: "Put the system into read-only mode. Deposits, edits, approvals and anything that makes a change to the data will be disabled."
29
+ end
30
+
31
+ group :repository_management do
32
+ feature :active_deposit_agreement_acceptance,
33
+ default: Hyrax.config.active_deposit_agreement_acceptance?,
34
+ description: "Require an active acceptance of the deposit agreement by checking a checkbox"
35
+
36
+ # Note, if this is deactivated, a default admin set will be created and all
37
+ # works will be assigned to it when they are created.
38
+ feature :assign_admin_set,
39
+ default: true,
40
+ description: "Ability to assign uploaded items to an admin set"
41
+
42
+ feature :batch_upload,
43
+ default: false,
44
+ description: "Enable uploading batches of works"
45
+
46
+ feature :proxy_deposit,
47
+ default: true,
48
+ description: "Depositors may designate proxies to deposit works on their behalf"
49
+
50
+ feature :show_deposit_agreement,
51
+ default: true,
52
+ description: "Show a deposit agreement to users creating works"
53
+
54
+ feature :transfer_works,
55
+ default: true,
56
+ description: "Depositors may transfer their works to another user"
57
+ end
58
+
49
59
  rescue Flipflop::StrategyError, Flipflop::FeatureError => err
50
60
  Hyrax.logger.warn "Ignoring #{err}: #{err.message}"
51
61
  end
@@ -7,3 +7,7 @@ Valkyrie::IndexingAdapter.register(
7
7
  Valkyrie::IndexingAdapter.register(
8
8
  Valkyrie::Indexing::NullIndexingAdapter.new, :null_index
9
9
  )
10
+ Valkyrie::IndexingAdapter.register(
11
+ Valkyrie::Indexing::RedisQueue::IndexingAdapter.new,
12
+ :redis_queue
13
+ )
@@ -2,7 +2,9 @@
2
2
 
3
3
  # Any options set here are to override Rails 7.2 configuration defaults
4
4
 
5
- # These fix a couple of issues arising from Rails 7.2 enforcement of HTML5 semantics
6
- # by default when using certain Rails methods
7
- Rails.application.config.action_view.button_to_generates_button_tag = false
8
- Rails.application.config.action_view.sanitizer_vendor = Rails::HTML4::Sanitizer
5
+ if Rails::VERSION::MAJOR >= 7
6
+ # These fix a couple of issues arising from Rails 7.2 enforcement of HTML5 semantics
7
+ # by default when using certain Rails methods
8
+ Rails.application.config.action_view.button_to_generates_button_tag = false
9
+ Rails.application.config.action_view.sanitizer_vendor = Rails::HTML4::Sanitizer
10
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ return if Rails::VERSION::MAJOR >= 7
4
+
5
+ # Taken from https://github.com/trailblazer/reform-rails/issues/86#issuecomment-763120151
6
+ # rubocop:disable Metrics/CyclomaticComplexity
7
+ # rubocop:disable Lint/UselessAssignment
8
+ module Reform
9
+ class Contract < Disposable::Twin
10
+ class Result
11
+ private
12
+
13
+ # this doesn't do nested errors (e.g. )
14
+ def filter_for(method, *args)
15
+ @results.collect { |r| r.public_send(method, *args).to_h }
16
+ .inject({}) { |hah, err| hah.merge(err) { |_key, old_v, new_v| (new_v.is_a?(Array) ? (old_v |= new_v) : old_v.merge(new_v)) } }
17
+ .find_all do |_k, v| # filter :nested=>{:something=>["too nested!"]} #DISCUSS: do we want that here?
18
+ if v.is_a?(Hash)
19
+ nested_errors = v.select { |attr_key, val| attr_key.is_a?(Integer) && val.is_a?(Array) && val.any? }
20
+ v = nested_errors.to_a if nested_errors.any?
21
+ end
22
+ v.is_a?(ActiveModel::DeprecationHandlingMessageArray)
23
+ end.to_h
24
+ end
25
+ end
26
+ end
27
+ end
28
+ # rubocop:enable Metrics/CyclomaticComplexity
29
+ # rubocop:disable Lint/UselessAssignment
@@ -20,4 +20,5 @@ attributes:
20
20
  type: string
21
21
  predicate: http://id.loc.gov/vocabulary/relators/dpt
22
22
  index_keys:
23
+ - "depositor_ssim"
23
24
  - "depositor_tesim"
@@ -68,14 +68,14 @@ services:
68
68
  chrome:
69
69
  image: selenium/standalone-chromium:4
70
70
  environment:
71
- # - START_XVFB=false
71
+ # - START_XVFB=false
72
72
  - SE_NODE_SESSION_TIMEOUT=800
73
73
  - SE_ENABLE_TRACING=false
74
74
  - SE_ENABLE_BROWSER_LEFTOVERS_CLEANUP=true
75
75
  - SE_BROWSER_ARGS_DISABLE_DSHM=--disable-dev-shm-usage
76
76
  - SE_BROWSER_ARGS_HEADLESS=--headless=new
77
- # logging:
78
- # driver: none
77
+ # logging:
78
+ # driver: none
79
79
  volumes:
80
80
  - /dev/shm:/dev/shm
81
81
  shm_size: 2g
@@ -118,7 +118,7 @@ services:
118
118
  memcached:
119
119
  image: bitnami/memcached
120
120
  ports:
121
- - '11211:11211'
121
+ - "11211:11211"
122
122
  networks:
123
123
  - hyrax
124
124
 
@@ -32,7 +32,7 @@ You can also try [Running Hyrax-based application in local VM](https://github.co
32
32
  During development, running only the dependent services in a container environment may be beneficial. This avoids potential headaches concerning file permissions and eases the use of debugging tools. The application generation instructions below use [Lando](https://lando.dev) to achieve this setup.
33
33
 
34
34
  This document contains instructions specific to setting up an app with __Hyrax
35
- v5.1.0__. If you are looking for instructions on installing a different
35
+ v5.2.0__. If you are looking for instructions on installing a different
36
36
  version, be sure to select the appropriate branch or tag from the drop-down
37
37
  menu above.
38
38
 
@@ -148,7 +148,7 @@ Generate a new Rails application using the template.
148
148
  **NOTE:** `HYRAX_SKIP_WINGS` is needed here to avoid loading the Wings compatibility layer during the application generation process.
149
149
 
150
150
  ```shell
151
- HYRAX_SKIP_WINGS=true rails _7.2.2.1_ new my_app --database=postgresql -m https://raw.githubusercontent.com/samvera/hyrax/hyrax-v5.1.0-beta1/template.rb
151
+ HYRAX_SKIP_WINGS=true rails _7.2.2.1_ new my_app --database=postgresql -m https://raw.githubusercontent.com/samvera/hyrax/hyrax-v5.2.0/template.rb
152
152
  ```
153
153
 
154
154
  Generating a new Rails application using Hyrax's template above takes cares of a number of steps for you, including:
data/hyrax.gemspec CHANGED
@@ -32,7 +32,7 @@ SUMMARY
32
32
  # NOTE: rails does not follow sem-ver conventions, it's
33
33
  # minor version releases can include breaking changes; see
34
34
  # http://guides.rubyonrails.org/maintenance_policy.html
35
- spec.add_dependency 'rails', '~> 7.2', '< 8.0'
35
+ spec.add_dependency 'rails', '> 6.1', '< 8.0'
36
36
 
37
37
  spec.add_dependency 'active-fedora', '~> 15.0'
38
38
  spec.add_dependency 'almond-rails', '~> 0.1'
@@ -100,7 +100,7 @@ SUMMARY
100
100
  spec.add_development_dependency 'pg', '~> 1.2'
101
101
  spec.add_development_dependency 'rspec-activemodel-mocks', '~> 1.0'
102
102
  spec.add_development_dependency 'rspec-its', '~> 1.1'
103
- spec.add_development_dependency 'rspec-rails', '~> 7.0'
103
+ spec.add_development_dependency 'rspec-rails', '> 6.1'
104
104
  spec.add_development_dependency 'rspec_junit_formatter'
105
105
  spec.add_development_dependency "selenium-webdriver", '~> 4.4'
106
106
  spec.add_development_dependency 'i18n-debug'
@@ -13,6 +13,7 @@ module Freyja
13
13
  # was modified in the database between been read into memory and persisted
14
14
  # rubocop:disable Lint/UnusedMethodArgument
15
15
  def save(resource:, external_resource: false, perform_af_validation: false)
16
+ was_wings = resource.respond_to?(:wings?) && resource.wings?
16
17
  orm_object = resource_factory.from_resource(resource: resource)
17
18
  orm_object.transaction do
18
19
  orm_object.save!
@@ -23,18 +24,24 @@ module Freyja
23
24
  "Called from #{Gem.location_of_caller.join(':')}"
24
25
  end
25
26
  end
26
- convert_and_migrate_resource(orm_object)
27
+ convert_and_migrate_resource(orm_object, was_wings)
27
28
 
28
29
  rescue ActiveRecord::StaleObjectError
29
30
  raise Valkyrie::Persistence::StaleObjectError, "The object #{resource.id} has been updated by another process."
30
31
  end
31
32
  # rubocop:enable Lint/UnusedMethodArgument
32
33
 
33
- def convert_and_migrate_resource(orm_object)
34
+ def convert_and_migrate_resource(orm_object, was_wings)
34
35
  new_resource = resource_factory.to_resource(object: orm_object)
35
- if Hyrax.config.valkyrie_transition?
36
+ # if the resource was wings and is now a Valkyrie resource, we need to migrate sipity, files, and members
37
+ if Hyrax.config.valkyrie_transition? && was_wings && !new_resource.wings?
36
38
  MigrateFilesToValkyrieJob.perform_later(new_resource) if new_resource.is_a?(Hyrax::FileSet) && new_resource.file_ids.size == 1 && new_resource.file_ids.first.id.to_s.match('/files/')
37
- MigrateResourcesJob.perform_later(ids: new_resource.member_ids.map(&:to_s)) if new_resource.is_a?(Hyrax::Work)
39
+ # migrate any members if the resource is a Hyrax work
40
+ if new_resource.is_a?(Hyrax::Work)
41
+ member_ids = new_resource.member_ids.map(&:to_s)
42
+ MigrateResourcesJob.perform_later(ids: member_ids) unless member_ids.empty?
43
+ MigrateSipityEntityJob.perform_now(id: new_resource.id.to_s)
44
+ end
38
45
  end
39
46
  new_resource
40
47
  end