hyrax 2.9.0 → 2.9.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c050894909dcdbe63b34640d24f9f665e3818850cf2f4c5a0d92af23ae51cf62
4
- data.tar.gz: 42a5a185ee2d26c9ab54d544a8261fc2bd24c01b99903092e5d54a9c5dcee054
3
+ metadata.gz: '0148443e7ca6987d77b7ccbad46c89c895ae60e226565819b095293884c040cc'
4
+ data.tar.gz: 5a2cfda462e5415dc6c736dcbaaf4bb7b7a202fa0afe54c2819026f4559d7942
5
5
  SHA512:
6
- metadata.gz: a0fab1e2979598561c1f4afd61e2434c0af3529005c7f6394f9605d5c30e4e95df45a7c23cf665ac6ee647360a27ef286870a7456b8b57a0ec17e905f8d474af
7
- data.tar.gz: 55d6ffdace586396f41b327dceca10da11eeedbcee3d0be0abeafa3635574425e79fa6b8dd0ba831870b9f6d464e0067da889d46e5318051d63f00a502cff892
6
+ metadata.gz: faaee31b6dec44292d47981fe77d22bc9f8f40865670b9f2b1a470aca00b10193cb01931c1084a9622cb3a4e6fca5803c1b6a8a77965dca75619cc59f5da1d67
7
+ data.tar.gz: b3232036171e55e8166da5d4886d52b91fe6ce3f0c05018508deee6b594491df87b0d7b925b477e4d8a6a5134c0233026433d4df47d9902c28e074614dd3e18d
data/.circleci/config.yml CHANGED
@@ -12,7 +12,7 @@ jobs:
12
12
  default: 1.17.3
13
13
  rails_version:
14
14
  type: string
15
- default: '5.2.4.3'
15
+ default: '5.2.6'
16
16
  executor:
17
17
  name: 'samvera/ruby'
18
18
  ruby_version: << parameters.ruby_version >>
@@ -57,7 +57,7 @@ jobs:
57
57
  default: 1.17.3
58
58
  rails_version:
59
59
  type: string
60
- default: '5.2.4.3'
60
+ default: '5.2.6'
61
61
  executor:
62
62
  name: 'samvera/ruby'
63
63
  ruby_version: << parameters.ruby_version >>
@@ -136,10 +136,10 @@ workflows:
136
136
  jobs:
137
137
  - bundle:
138
138
  ruby_version: "2.5.8"
139
- rails_version: "5.2.4.3"
139
+ rails_version: "5.2.6"
140
140
  - build:
141
141
  ruby_version: "2.5.8"
142
- rails_version: "5.2.4.3"
142
+ rails_version: "5.2.6"
143
143
  requires:
144
144
  - bundle
145
145
  - test:
@@ -151,10 +151,10 @@ workflows:
151
151
  jobs:
152
152
  - bundle:
153
153
  ruby_version: "2.6.6"
154
- rails_version: "5.2.4.3"
154
+ rails_version: "5.2.6"
155
155
  - build:
156
156
  ruby_version: "2.6.6"
157
- rails_version: "5.2.4.3"
157
+ rails_version: "5.2.6"
158
158
  requires:
159
159
  - bundle
160
160
  - test:
@@ -166,11 +166,11 @@ workflows:
166
166
  jobs:
167
167
  - bundle:
168
168
  ruby_version: "2.7.1"
169
- rails_version: "5.2.4.3"
169
+ rails_version: "5.2.6"
170
170
  bundler_version: "2.1.2"
171
171
  - build:
172
172
  ruby_version: "2.7.1"
173
- rails_version: "5.2.4.3"
173
+ rails_version: "5.2.6"
174
174
  bundler_version: "2.1.2"
175
175
  requires:
176
176
  - bundle
data/.regen CHANGED
@@ -1 +1 @@
1
- 3
1
+ 3.http_method
data/README.md CHANGED
@@ -158,7 +158,7 @@ NOTE: The steps need to be done in order to create a new Hyrax based app.
158
158
  Generate a new Rails application using the template.
159
159
 
160
160
  ```
161
- rails _5.2.4.3_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v2.9.0/template.rb
161
+ rails _5.2.6_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v2.9.5/template.rb
162
162
  ```
163
163
 
164
164
  Generating a new Rails application using Hyrax's template above takes cares of a number of steps for you, including:
@@ -104,6 +104,7 @@
104
104
  //= require hyrax/tabbed_form
105
105
  //= require hyrax/turbolinks_events
106
106
  //= require hyrax/i18n_helper
107
+ //= require hyrax/skip_to_content
107
108
 
108
109
  // this needs to be after batch_select so that the form ids get setup correctly
109
110
  //= require hyrax/batch_edit
@@ -0,0 +1,15 @@
1
+ // This code is to implement skip_to_content
2
+
3
+ Blacklight.onLoad(function () {
4
+ $(".skip-to-content").click(function(event) {
5
+ event.preventDefault();
6
+ // element to focus on
7
+ var skipTo = '#' + $(this)[0].firstElementChild.hash.split('#')[1];
8
+
9
+ // Setting 'tabindex' to -1 takes an element out of normal
10
+ // tab flow but allows it to be focused via javascript
11
+ $(skipTo).attr('tabindex', -1).on('blur focusout', function () {
12
+ $(this).removeAttr('tabindex');
13
+ }).focus();
14
+ });
15
+ });
@@ -145,7 +145,7 @@ module Hyrax
145
145
 
146
146
  def iiif_manifest_presenter
147
147
  IiifManifestPresenter.new(curation_concern_from_search_results).tap do |p|
148
- p.hostname = request.hostname
148
+ p.hostname = request.base_url
149
149
  p.ability = current_ability
150
150
  end
151
151
  end
@@ -85,13 +85,18 @@ module Hyrax
85
85
  actor.revert_content(params[:revision])
86
86
  elsif params.key?(:file_set)
87
87
  if params[:file_set].key?(:files)
88
- actor.update_content(params[:file_set][:files].first)
88
+ actor.update_content(uploaded_file_from_path)
89
89
  else
90
90
  update_metadata
91
91
  end
92
92
  end
93
93
  end
94
94
 
95
+ def uploaded_file_from_path
96
+ uploaded_file = CarrierWave::SanitizedFile.new(params[:file_set][:files].first)
97
+ Hyrax::UploadedFile.create(user_id: current_user.id, file: uploaded_file)
98
+ end
99
+
95
100
  def after_update_response
96
101
  respond_to do |wants|
97
102
  wants.html do
@@ -41,7 +41,7 @@ module Hyrax
41
41
 
42
42
  def find_user
43
43
  @user = ::User.from_url_component(params[:id])
44
- redirect_to root_path, alert: "User '#{params[:id]}' does not exist" if @user.nil?
44
+ redirect_to root_path, alert: "User does not exist" unless @user
45
45
  end
46
46
 
47
47
  def sort_value
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+ class EmbargoExpiryJob < Hyrax::ApplicationJob
3
+ def perform
4
+ records_with_expired_embargos.each do |id|
5
+ work = ActiveFedora::Base.find(id)
6
+ Hyrax::Actors::EmbargoActor.new(work).destroy
7
+ end
8
+ end
9
+
10
+ ##
11
+ # @return [Enumerator<String>] ids for all the objects that have expired active embargoes
12
+ def records_with_expired_embargos
13
+ Hyrax::EmbargoService.assets_with_expired_embargoes.map(&:id)
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+ class LeaseExpiryJob < Hyrax::ApplicationJob
3
+ def perform
4
+ records_with_expired_leases.each do |id|
5
+ work = ActiveFedora::Base.find(id)
6
+ Hyrax::Actors::LeaseActor.new(work).destroy
7
+ end
8
+ end
9
+
10
+ ##
11
+ # @return [Enumerator<String>] ids for all the objects that have expired active leases
12
+ def records_with_expired_leases
13
+ Hyrax::LeaseService.assets_with_expired_leases.map(&:id)
14
+ end
15
+ end
@@ -73,7 +73,7 @@ module Hyrax
73
73
  ids = PermissionTemplateAccess.for_user(ability: self,
74
74
  access: ['deposit', 'manage'])
75
75
  .joins(:permission_template)
76
- .pluck('DISTINCT source_id')
76
+ .pluck(Arel.sql('DISTINCT source_id'))
77
77
  query = "_query_:\"{!raw f=has_model_ssim}AdminSet\" AND {!terms f=id}#{ids.join(',')}"
78
78
  ActiveFedora::SolrService.count(query).positive?
79
79
  end
@@ -67,7 +67,7 @@ module Hyrax
67
67
  end
68
68
 
69
69
  def file_size
70
- self[Solrizer.solr_name("file_size")]
70
+ self["file_size_lts"]
71
71
  end
72
72
 
73
73
  def filename
@@ -13,7 +13,7 @@ module Hyrax
13
13
  # If calling from Abilities, pass the ability. If you try to get the ability from the user, you end up in an infinit loop.
14
14
  def self.collection_type_ids_for_user(roles:, user: nil, ability: nil)
15
15
  return false unless user.present? || ability.present?
16
- return Hyrax::CollectionType.all.pluck('DISTINCT id') if user_admin?(user, ability)
16
+ return Hyrax::CollectionType.all.pluck(Arel.sql('DISTINCT id')) if user_admin?(user, ability)
17
17
  Hyrax::CollectionTypeParticipant.where(agent_type: Hyrax::CollectionTypeParticipant::USER_TYPE,
18
18
  agent_id: user_id(user, ability),
19
19
  access: roles)
@@ -21,7 +21,7 @@ module Hyrax
21
21
  Hyrax::CollectionTypeParticipant.where(agent_type: Hyrax::CollectionTypeParticipant::GROUP_TYPE,
22
22
  agent_id: user_groups(user, ability),
23
23
  access: roles)
24
- ).pluck('DISTINCT hyrax_collection_type_id')
24
+ ).pluck(Arel.sql('DISTINCT hyrax_collection_type_id'))
25
25
  end
26
26
 
27
27
  # @api public
@@ -174,7 +174,7 @@ module Hyrax
174
174
  def self.agent_ids_for(collection_type:, agent_type:, access:)
175
175
  Hyrax::CollectionTypeParticipant.where(hyrax_collection_type_id: collection_type.id,
176
176
  agent_type: agent_type,
177
- access: access).pluck('DISTINCT agent_id')
177
+ access: access).pluck(Arel.sql('DISTINCT agent_id'))
178
178
  end
179
179
  private_class_method :agent_ids_for
180
180
 
@@ -13,7 +13,7 @@ module Hyrax
13
13
  def self.source_ids_for_user(access:, ability:, source_type: nil, exclude_groups: [])
14
14
  scope = PermissionTemplateAccess.for_user(ability: ability, access: access, exclude_groups: exclude_groups)
15
15
  .joins(:permission_template)
16
- ids = scope.pluck('DISTINCT source_id')
16
+ ids = scope.pluck(Arel.sql('DISTINCT source_id'))
17
17
  return ids unless source_type
18
18
  filter_source(source_type: source_type, ids: ids)
19
19
  end
@@ -10,7 +10,7 @@ module Hyrax
10
10
 
11
11
  def show
12
12
  if parent_presenter
13
- polymorphic_path([:hyrax, :parent, presenter.model_name.singular],
13
+ polymorphic_path([:hyrax, :parent, presenter.model_name.singular.to_sym],
14
14
  parent_id: parent_presenter.id,
15
15
  id: presenter.id)
16
16
  else
@@ -24,7 +24,7 @@ HTML Properties:
24
24
  </div>
25
25
  <div class="message has-warning hidden"></div>
26
26
  <div style="margin-top: 10px">
27
- <%= link_to t('.attach_new_work'), polymorphic_path([main_app, :new, :hyrax, :parent, curation_concern.model_name.singular], parent_id: curation_concern.id), target: "_blank", class: 'btn btn-primary' %>
27
+ <%= link_to t('.attach_new_work'), polymorphic_path([main_app, :new, :hyrax, :parent, curation_concern.model_name.singular.to_sym], parent_id: curation_concern.id), target: "_blank", class: 'btn btn-primary' %>
28
28
  </div>
29
29
  <table class="table table-striped">
30
30
  <caption><%= t('.caption') %></caption>
@@ -1,3 +1,5 @@
1
1
  <%= f.full_error(:visibility) %>
2
2
  <%= f.full_error(:embargo_release_date) %>
3
3
  <%= f.full_error(:visibility_after_embargo) %>
4
+ <%= f.full_error(:lease_expiration_date) %>
5
+ <%= f.full_error(:visibility_after_lease) %>
@@ -15,7 +15,7 @@
15
15
  <ul class="dropdown-menu">
16
16
  <% presenter.valid_child_concerns.each do |concern| %>
17
17
  <li>
18
- <%= link_to "Attach #{concern.human_readable_type}", polymorphic_path([main_app, :new, :hyrax, :parent, concern.model_name.singular], parent_id: presenter.id) %>
18
+ <%= link_to "Attach #{concern.human_readable_type}", polymorphic_path([main_app, :new, :hyrax, :parent, concern.model_name.singular.to_sym], parent_id: presenter.id) %>
19
19
  </li>
20
20
  <% end %>
21
21
  </ul>
@@ -7,7 +7,7 @@
7
7
  <% provide :files_tab do %>
8
8
  <p class="instructions"><%= t("hyrax.batch_uploads.files.instructions") %></p>
9
9
  <p class="switch-upload-type"><%= t("hyrax.batch_uploads.files.upload_type_instructions") %>
10
- <%= link_to t("hyrax.batch_uploads.files.button_label"), [main_app, :new, Hyrax.primary_work_type.model_name.singular_route_key] %>
10
+ <%= link_to t("hyrax.batch_uploads.files.button_label"), [main_app, :new, Hyrax.primary_work_type.model_name.singular_route_key.to_sym] %>
11
11
  </p>
12
12
  <% end %>
13
13
  <%= render 'hyrax/base/guts4form', f: f, tabs: form_tabs_for(form: f.object) %>
data/hyrax.gemspec CHANGED
@@ -50,7 +50,7 @@ SUMMARY
50
50
  spec.add_dependency 'font-awesome-rails', '~> 4.2'
51
51
  spec.add_dependency 'hydra-derivatives', '~> 3.3'
52
52
  spec.add_dependency 'hydra-editor', '>= 3.3', '< 6.0'
53
- spec.add_dependency 'hydra-head', '>= 10.6.1'
53
+ spec.add_dependency 'hydra-head', '>= 10.6.1', '< 12'
54
54
  spec.add_dependency 'hydra-works', '>= 0.16', '< 2.0'
55
55
  spec.add_dependency 'iiif_manifest', '>= 0.3', '< 0.6'
56
56
  spec.add_dependency 'jquery-datatables-rails', '~> 3.4'
@@ -68,7 +68,7 @@ SUMMARY
68
68
  spec.add_dependency 'posix-spawn'
69
69
  spec.add_dependency 'power_converter', '~> 0.1', '>= 0.1.2'
70
70
  spec.add_dependency 'pul_uv_rails', '~> 2.0'
71
- spec.add_dependency 'qa', '~> 2.0' # questioning_authority
71
+ spec.add_dependency 'qa', '>= 2.0', '< 6.0' # questioning_authority
72
72
  spec.add_dependency 'rails_autolink', '~> 1.1'
73
73
  spec.add_dependency 'rdf-rdfxml' # controlled vocabulary importer
74
74
  spec.add_dependency 'rdf-vocab', '< 3.1.5'
@@ -20,6 +20,10 @@ class CatalogController < ApplicationController
20
20
  config.view.gallery.partials = [:index_header, :index]
21
21
  config.view.slideshow.partials = [:index]
22
22
 
23
+ # Because too many times on Samvera tech people raise a problem regarding a failed query to SOLR.
24
+ # Often, it's because they inadvertantly exceeded the character limit of a GET request.
25
+ config.http_method = :post
26
+
23
27
  ## Default parameters to send to solr for all search-like requests. See also SolrHelper#solr_search_params
24
28
  config.default_solr_params = {
25
29
  qt: "search",
@@ -51,7 +51,7 @@ es:
51
51
  suffix: "@example.org"
52
52
  footer:
53
53
  copyright_html: "<strong>Copyright &copy; 2018 Samvera</strong> bajo licencia de Apache, Version 2.0"
54
- service_html: Un servicio de <a href="http://samvera.org/" class="navbar-link" target="_blank">Samvera/a>.
54
+ service_html: Un servicio de <a href="http://samvera.org/" class="navbar-link" target="_blank">Samvera</a>.
55
55
  institution_name: institución
56
56
  institution_name_full: El nombre de la institución
57
57
  product_name: Hyrax
@@ -479,10 +479,14 @@ module Hyrax
479
479
  attr_writer :translate_uri_to_id
480
480
 
481
481
  def translate_uri_to_id
482
- @translate_uri_to_id ||= lambda do |uri|
483
- baseparts = 2 + [(::Noid::Rails.config.template.gsub(/\.[rsz]/, '').length.to_f / 2).ceil, 4].min
484
- uri.to_s.sub("#{ActiveFedora.fedora.host}#{ActiveFedora.fedora.base_path}", '').split('/', baseparts).last
485
- end
482
+ @translate_uri_to_id ||=
483
+ begin
484
+ baseparts = 2 + [(::Noid::Rails.config.template.gsub(/\.[rsz]/, '').length.to_f / 2).ceil, 4].min
485
+
486
+ lambda do |uri|
487
+ uri.to_s.split(ActiveFedora.fedora.base_path).last.split('/', baseparts).last
488
+ end
489
+ end
486
490
  end
487
491
 
488
492
  attr_writer :translate_id_to_uri
data/lib/hyrax/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hyrax
2
- VERSION = '2.9.0'.freeze
2
+ VERSION = '2.9.5'.freeze
3
3
  end
data/template.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # Hack for https://github.com/rails/rails/issues/35153
2
2
  gsub_file 'Gemfile', /^gem ["']sqlite3["']$/, 'gem "sqlite3", "~> 1.3.0"'
3
- gem 'hyrax', '2.9.0'
3
+ gem 'hyrax', '2.9.5'
4
4
  run 'bundle install'
5
5
  generate 'hyrax:install', '-f'
6
6
  rails_command 'db:migrate'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyrax
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.0
4
+ version: 2.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -11,10 +11,10 @@ authors:
11
11
  - Jeremy Friesen
12
12
  - Trey Pendragon
13
13
  - Esmé Cowles
14
- autorequire:
14
+ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2020-07-28 00:00:00.000000000 Z
17
+ date: 2021-05-07 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rails
@@ -327,6 +327,9 @@ dependencies:
327
327
  - - ">="
328
328
  - !ruby/object:Gem::Version
329
329
  version: 10.6.1
330
+ - - "<"
331
+ - !ruby/object:Gem::Version
332
+ version: '12'
330
333
  type: :runtime
331
334
  prerelease: false
332
335
  version_requirements: !ruby/object:Gem::Requirement
@@ -334,6 +337,9 @@ dependencies:
334
337
  - - ">="
335
338
  - !ruby/object:Gem::Version
336
339
  version: 10.6.1
340
+ - - "<"
341
+ - !ruby/object:Gem::Version
342
+ version: '12'
337
343
  - !ruby/object:Gem::Dependency
338
344
  name: hydra-works
339
345
  requirement: !ruby/object:Gem::Requirement
@@ -580,16 +586,22 @@ dependencies:
580
586
  name: qa
581
587
  requirement: !ruby/object:Gem::Requirement
582
588
  requirements:
583
- - - "~>"
589
+ - - ">="
584
590
  - !ruby/object:Gem::Version
585
591
  version: '2.0'
592
+ - - "<"
593
+ - !ruby/object:Gem::Version
594
+ version: '6.0'
586
595
  type: :runtime
587
596
  prerelease: false
588
597
  version_requirements: !ruby/object:Gem::Requirement
589
598
  requirements:
590
- - - "~>"
599
+ - - ">="
591
600
  - !ruby/object:Gem::Version
592
601
  version: '2.0'
602
+ - - "<"
603
+ - !ruby/object:Gem::Version
604
+ version: '6.0'
593
605
  - !ruby/object:Gem::Dependency
594
606
  name: rails_autolink
595
607
  requirement: !ruby/object:Gem::Requirement
@@ -1287,6 +1299,7 @@ files:
1287
1299
  - app/assets/javascripts/hyrax/select_submit.js
1288
1300
  - app/assets/javascripts/hyrax/select_work_type.es6
1289
1301
  - app/assets/javascripts/hyrax/single_use_links_manager.js
1302
+ - app/assets/javascripts/hyrax/skip_to_content.js
1290
1303
  - app/assets/javascripts/hyrax/sort_and_per_page.es6
1291
1304
  - app/assets/javascripts/hyrax/sorting.js
1292
1305
  - app/assets/javascripts/hyrax/tabbed_form.es6
@@ -1502,6 +1515,7 @@ files:
1502
1515
  - app/jobs/content_update_event_job.rb
1503
1516
  - app/jobs/create_derivatives_job.rb
1504
1517
  - app/jobs/create_work_job.rb
1518
+ - app/jobs/embargo_expiry_job.rb
1505
1519
  - app/jobs/event_job.rb
1506
1520
  - app/jobs/file_set_attached_event_job.rb
1507
1521
  - app/jobs/fixity_check_job.rb
@@ -1518,6 +1532,7 @@ files:
1518
1532
  - app/jobs/ingest_job.rb
1519
1533
  - app/jobs/ingest_local_file_job.rb
1520
1534
  - app/jobs/inherit_permissions_job.rb
1535
+ - app/jobs/lease_expiry_job.rb
1521
1536
  - app/jobs/resolrize_job.rb
1522
1537
  - app/jobs/stream_notifications_job.rb
1523
1538
  - app/jobs/user_edit_profile_event_job.rb
@@ -2443,7 +2458,7 @@ homepage: http://github.com/samvera/hyrax
2443
2458
  licenses:
2444
2459
  - Apache-2.0
2445
2460
  metadata: {}
2446
- post_install_message:
2461
+ post_install_message:
2447
2462
  rdoc_options: []
2448
2463
  require_paths:
2449
2464
  - lib
@@ -2458,8 +2473,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2458
2473
  - !ruby/object:Gem::Version
2459
2474
  version: '0'
2460
2475
  requirements: []
2461
- rubygems_version: 3.0.3
2462
- signing_key:
2476
+ rubygems_version: 3.1.6
2477
+ signing_key:
2463
2478
  specification_version: 4
2464
2479
  summary: Hyrax is a front-end based on the robust Samvera framework, providing a user
2465
2480
  interface for common repository features. Hyrax offers the ability to create repository