hyrax 4.0.0.rc1 → 4.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +61 -0
  3. data/.dassie/Gemfile +1 -1
  4. data/.dassie/config/initializers/redis_config.rb +8 -1
  5. data/.github/CONTRIBUTING.md +39 -27
  6. data/.koppie/config/initializers/redis_config.rb +8 -1
  7. data/.regen +1 -1
  8. data/CONTAINERS.md +4 -4
  9. data/Dockerfile +1 -1
  10. data/README.md +2 -2
  11. data/app/actors/hyrax/actors/create_with_files_actor.rb +1 -1
  12. data/app/builders/hyrax/bootstrap_breadcrumbs_builder.rb +1 -1
  13. data/app/controllers/concerns/hyrax/controller.rb +2 -1
  14. data/app/controllers/hyrax/admin/strategies_controller.rb +2 -2
  15. data/app/forms/hyrax/forms/administrative_set_form.rb +1 -1
  16. data/app/forms/hyrax/forms/pcdm_collection_form.rb +2 -2
  17. data/app/forms/hyrax/forms/pcdm_object_form.rb +1 -1
  18. data/app/forms/hyrax/forms/permission.rb +2 -2
  19. data/app/forms/hyrax/forms/resource_form.rb +10 -10
  20. data/app/forms/hyrax/forms/work_embargo_form.rb +3 -3
  21. data/app/forms/hyrax/forms/work_lease_form.rb +3 -3
  22. data/app/helpers/hyrax/content_block_helper_behavior.rb +1 -1
  23. data/app/helpers/hyrax/iiif_helper.rb +1 -1
  24. data/app/models/collection_branding_info.rb +7 -13
  25. data/app/models/hyrax/permission_template.rb +1 -1
  26. data/app/presenters/hyrax/iiif_manifest_presenter.rb +1 -1
  27. data/app/presenters/hyrax/presenter_factory.rb +2 -2
  28. data/app/services/hyrax/custom_queries/navigators/find_files.rb +1 -4
  29. data/app/services/hyrax/lock_manager.rb +36 -6
  30. data/app/services/hyrax/solr_service.rb +2 -2
  31. data/app/services/hyrax/visibility_reader.rb +1 -1
  32. data/app/services/hyrax/visibility_writer.rb +1 -1
  33. data/app/services/hyrax/workflow/permission_query.rb +5 -5
  34. data/app/validators/hyrax/collection_membership_validator.rb +2 -2
  35. data/app/views/layouts/hyrax/dashboard.html.erb +1 -1
  36. data/app/views/layouts/hyrax.html.erb +1 -1
  37. data/config/initializers/kaminari_engine_patch.rb +16 -0
  38. data/docker-compose-koppie.yml +0 -1
  39. data/docker-compose.yml +0 -1
  40. data/documentation/legacyREADME.md +3 -3
  41. data/hyrax.gemspec +4 -6
  42. data/lib/generators/hyrax/templates/config/initializers/redis_config.rb +8 -1
  43. data/lib/hyrax/configuration.rb +18 -1
  44. data/lib/hyrax/controlled_vocabularies/resource_label_caching.rb +1 -1
  45. data/lib/hyrax/engine.rb +2 -0
  46. data/lib/hyrax/redis_event_store.rb +21 -13
  47. data/lib/hyrax/transactions/transaction.rb +3 -2
  48. data/lib/hyrax/version.rb +1 -1
  49. data/lib/hyrax.rb +0 -1
  50. data/lib/wings/valkyrie/storage.rb +4 -1
  51. data/template.rb +1 -1
  52. metadata +24 -43
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a40b509766f1add062da64ebfa925e2f005b37f3b8ba98cf47869b126e5c5edb
4
- data.tar.gz: f8d8d154e6c12ba940ea317042ded3bddbbc8c5b3b4ba70df2edcb35715c3aca
3
+ metadata.gz: f7d9595ce45877e35b01b14d36cdefb89a1bb8978ab424bbe9907edcfebb693e
4
+ data.tar.gz: 516c7de64fc06ede1b8bd0843ad4ad98b01d39f7440c4723e72235880d52d34a
5
5
  SHA512:
6
- metadata.gz: b07a5c4beb95e72e33ebcdb6cd7c68837077760de21f73ff8a216c9a51eef7b32ca8c2331a3cfc54e17aae8964fa2c5cbd5981de052c822502141bc7ad3ee513
7
- data.tar.gz: cae0fc1b05c720927879e2c076e3ce9eac3fa623e44012f227ef43814028b95cfd7605c14f87e459d26259f9d3996c15848c25130ad128ca82c3a13a9298f237
6
+ metadata.gz: 7a4173fac3ac9ee096966e8019d7bbb00e80715b1a7672fd830920229b6236cd31b63c3099992137d107f47ef4a863db2137607c8f86f094bcd981e90443ac38
7
+ data.tar.gz: 8fe124964ed3356cbb93bf5db4d1d491d8927020dce6226c0046a8068504ea21b427b99a25fd48b81b7b36ebc1702a23479ce4fe89189d4851551d5e703aa8c2
data/.circleci/config.yml CHANGED
@@ -187,6 +187,67 @@ jobs:
187
187
 
188
188
  workflows:
189
189
  version: 2
190
+ ruby3-2:
191
+ jobs:
192
+ - bundle:
193
+ ruby_version: "3.2.2"
194
+ rails_version: "6.1.7.2"
195
+ bundler_version: "2.4.8"
196
+ - build:
197
+ ruby_version: "3.2.2"
198
+ rails_version: "6.1.7.2"
199
+ bundler_version: "2.4.8"
200
+ requires:
201
+ - bundle
202
+ - test:
203
+ name: "ruby3-2"
204
+ ruby_version: "3.2.2"
205
+ bundler_version: "2.4.8"
206
+ requires:
207
+ - build
208
+ - test:
209
+ name: "ruby3-2-valkyrie"
210
+ ruby_version: "3.2.2"
211
+ bundler_version: "2.4.8"
212
+ hyrax_valkyrie: "true"
213
+ requires:
214
+ - build
215
+ ruby3-1:
216
+ jobs:
217
+ - bundle:
218
+ ruby_version: "3.1.4"
219
+ rails_version: "6.1.7.2"
220
+ bundler_version: "2.4.8"
221
+ - build:
222
+ ruby_version: "3.1.4"
223
+ rails_version: "6.1.7.2"
224
+ bundler_version: "2.4.8"
225
+ requires:
226
+ - bundle
227
+ - test:
228
+ name: "ruby3-1"
229
+ ruby_version: "3.1.4"
230
+ bundler_version: "2.4.8"
231
+ requires:
232
+ - build
233
+ ruby3-0:
234
+ jobs:
235
+ - bundle:
236
+ ruby_version: "3.0.6"
237
+ rails_version: "6.1.7.2"
238
+ bundler_version: "2.4.8"
239
+ - build:
240
+ ruby_version: "3.0.6"
241
+ rails_version: "6.1.7.2"
242
+ bundler_version: "2.4.8"
243
+ requires:
244
+ - bundle
245
+ - test:
246
+ name: "ruby3-0"
247
+ ruby_version: "3.0.6"
248
+ bundler_version: "2.4.8"
249
+ requires:
250
+ - build
190
251
  ruby2-7:
191
252
  jobs:
192
253
  - bundle:
data/.dassie/Gemfile CHANGED
@@ -8,7 +8,7 @@ else
8
8
  end
9
9
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
10
10
 
11
- ruby '2.7.7'
11
+ ruby '3.2.1'
12
12
 
13
13
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
14
14
  gem 'rails', '~> 6.0'
@@ -1,4 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
  require 'redis'
3
+ require 'connection_pool'
3
4
  config = YAML.safe_load(ERB.new(IO.read(Rails.root.join('config', 'redis.yml'))).result)[Rails.env].with_indifferent_access
4
- Redis.current = Redis.new(config.merge(thread_safe: true))
5
+ config[:thread_safe] = true
6
+
7
+ size = ENV.fetch("HYRAX_REDIS_POOL_SIZE", 5)
8
+ timeout = ENV.fetch("HYRAX_REDIS_TIMEOUT", 5)
9
+
10
+ Hyrax.config.redis_connection =
11
+ ConnectionPool::Wrapper.new(size: size, timeout: timeout) { Redis.new(config) }
@@ -1,6 +1,6 @@
1
1
  # How to Contribute
2
2
 
3
- We want your help to make Samvera great. There are a few guidelines
3
+ We want your help to make the Samvera community great. There are a few guidelines
4
4
  that we need contributors to follow so that we can have a chance of
5
5
  keeping on top of things.
6
6
 
@@ -11,16 +11,27 @@ experience for all its members, whether they are at a formal gathering, in
11
11
  a social setting, or taking part in activities online. Please see our
12
12
  [Code of Conduct](CODE_OF_CONDUCT.md) for more information.
13
13
 
14
- ## Samvera Community Intellectual Property Licensing and Ownership
14
+ ## Language
15
15
 
16
- All code contributors must have an Individual Contributor License Agreement
17
- (iCLA) on file with the Samvera Steering Group. If the contributor works for
18
- an institution, the institution must have a Corporate Contributor License
19
- Agreement (cCLA) on file.
16
+ The language we use matters. Today, tomorrow, and for years to come
17
+ people will read the code we write. They will judge us for our
18
+ design, logic, and the words we use to describe the system.
20
19
 
21
- https://wiki.lyrasis.org/display/samvera/Samvera+Community+Intellectual+Property+Licensing+and+Ownership
20
+ Our words should be accessible. Favor descriptive words that give
21
+ meaning while avoiding reinforcing systemic inequities. For example,
22
+ in the Samvera community, we should favor using allowed\_list instead
23
+ of whitelist, denied\_list instead of blacklist, or source/copy
24
+ instead of master/slave.
22
25
 
23
- You should also add yourself to the `CONTRIBUTORS.md` file in the root of the project.
26
+ We're going to get it wrong, but this is a call to keep working to
27
+ make it right. View our code and the words we choose as a chance to
28
+ have a conversation. A chance to grow an understanding of the systems
29
+ we develop as well as the systems in which we live.
30
+
31
+ See [“Blacklists” and “whitelists”: a salutary warning concerning the
32
+ prevalence of racist language in discussions of predatory
33
+ publishing](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6148600/) for
34
+ further details.
24
35
 
25
36
  ## Contribution Tasks
26
37
 
@@ -34,7 +45,7 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
34
45
  ### Reporting Issues
35
46
 
36
47
  * Make sure you have a [GitHub account](https://github.com/signup/free)
37
- * Submit a [Github issue](./issues) by:
48
+ * Submit a [Github issue](https://github.com/samvera/hyrax/issues/) by:
38
49
  * Clearly describing the issue
39
50
  * Provide a descriptive summary
40
51
  * Explain the expected behavior
@@ -45,15 +56,22 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
45
56
 
46
57
  * Fork the repository on GitHub
47
58
  * Create a topic branch from where you want to base your work.
48
- * This is usually the master branch.
49
- * To quickly create a topic branch based on master; `git branch fix/master/my_contribution master`
50
- * Then checkout the new branch with `git checkout fix/master/my_contribution`.
51
- * Please avoid working directly on the `master` branch.
59
+ * This is usually the `main` branch.
60
+ * To quickly create a topic branch based on `main`; `git branch fix/main/my_contribution main`
61
+ * Then checkout the new branch with `git checkout fix/main/my_contribution`.
62
+ * Please avoid working directly on the `main` branch.
63
+ * Please do not create a branch called `master`. (See note below.)
52
64
  * You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
53
65
  * Make sure you have added sufficient tests and documentation for your changes.
54
66
  * Test functionality with RSpec; Test features / UI with Capybara.
55
67
  * Run _all_ the tests to assure nothing else was accidentally broken.
56
68
 
69
+ NOTE: This repository follows the [Samvera Community Code of Conduct](https://samvera.atlassian.net/wiki/spaces/samvera/pages/405212316/Code+of+Conduct)
70
+ and [language recommendations](#language).
71
+ Please ***do not*** create a branch called `master` for this repository or as part of
72
+ your pull request; the branch will either need to be removed or renamed before it can
73
+ be considered for inclusion in the code base and history of this repository.
74
+
57
75
  ### Documenting Code
58
76
 
59
77
  * All new public methods, modules, and classes should include inline documentation in [YARD](http://yardoc.org/).
@@ -63,15 +81,11 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
63
81
  * If you don't know exactly what a bit of code does, it is extra likely that it needs to be documented. Take a stab at it and ask for feedback in your pull request. You can use the 'blame' button on GitHub to identify the original developer of the code and @mention them in your comment.
64
82
  * This work greatly increases the usability of the code base and supports the on-ramping of new committers.
65
83
  * We will all be understanding of one another's time constraints in this area.
66
- * YARD examples:
67
- * [Hyrax::AdminSet](https://github.com/samvera/hyrax/blob/master/app/models/admin_set.rb)
68
- * [ActiveTriples::LocalName::Minter](https://github.com/ActiveTriples/active_triples-local_name/blob/master/lib/active_triples/local_name/minter.rb)
69
84
  * [Getting started with YARD](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md)
70
85
 
71
86
  ### Committing changes
72
87
 
73
88
  * Make commits of logical units.
74
- * Your commit should include a high level description of your work in HISTORY.textile
75
89
  * Check for unnecessary whitespace with `git diff --check` before committing.
76
90
  * Make sure your commit messages are [well formed](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
77
91
  * If you created an issue, you can close it by including "Closes #issue" in your commit message. See [Github's blog post for more details](https://github.com/blog/1386-closing-issues-via-commit-messages)
@@ -112,18 +126,16 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
112
126
 
113
127
  ### Submitting Changes
114
128
 
115
- [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
116
-
117
129
  * Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
118
- * Make sure your branch is up to date with its parent branch (i.e. master)
119
- * `git checkout master`
130
+ * Make sure your branch is up to date with its parent branch (i.e. main)
131
+ * `git checkout main`
120
132
  * `git pull --rebase`
121
133
  * `git checkout <your-branch>`
122
- * `git rebase master`
134
+ * `git rebase main`
123
135
  * It is a good idea to run your tests again.
124
136
  * If you've made more than one commit take a moment to consider whether squashing commits together would help improve their logical grouping.
125
137
  * [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
126
- * `git rebase --interactive master` ([See Github help](https://help.github.com/articles/interactive-rebase))
138
+ * `git rebase --interactive main` ([See Github help](https://help.github.com/articles/interactive-rebase))
127
139
  * Squashing your branch's changes into one commit is "good form" and helps the person merging your request to see everything that is going on.
128
140
  * Push your changes to a topic branch in your fork of the repository.
129
141
  * Submit a pull request from your fork to the project.
@@ -133,14 +145,14 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
133
145
  We adopted [Github's Pull Request Review](https://help.github.com/articles/about-pull-request-reviews/) for our repositories.
134
146
  Common checks that may occur in our repositories:
135
147
 
136
- 1. Travis CI - where our automated tests are running
137
- 2. Hound CI - where we check for style violations
148
+ 1. [CircleCI](https://circleci.com/gh/samvera) - where our automated tests are running
149
+ 2. RuboCop/Bixby - where we check for style violations
138
150
  3. Approval Required - Github enforces at least one person approve a pull request. Also, all reviewers that have chimed in must approve.
139
151
  4. CodeClimate - is our code remaining healthy (at least according to static code analysis)
140
152
 
141
153
  If one or more of the required checks failed (or are incomplete), the code should not be merged (and the UI will not allow it). If all of the checks have passed, then anyone on the project (including the pull request submitter) may merge the code.
142
154
 
143
- *Example: Carolyn submits a pull request, Justin reviews the pull request and approves. However, Justin is still waiting on other checks (Travis CI is usually the culprit), so he does not merge the pull request. Eventually, all of the checks pass. At this point, Carolyn or anyone else may merge the pull request.*
155
+ *Example: Carolyn submits a pull request, Justin reviews the pull request and approves. However, Justin is still waiting on other checks (CI tests are usually the culprit), so he does not merge the pull request. Eventually, all of the checks pass. At this point, Carolyn or anyone else may merge the pull request.*
144
156
 
145
157
  #### Things to Consider When Reviewing
146
158
 
@@ -157,7 +169,7 @@ This is your chance for a mentoring moment of another developer. Take time to gi
157
169
  * Do new or changed methods, modules, and classes have documentation?
158
170
  * Does the commit contain more than it should? Are two separate concerns being addressed in one commit?
159
171
  * Does the description of the new/changed specs match your understanding of what the spec is doing?
160
- * Did the Travis tests complete successfully?
172
+ * Did the Continuous Integration tests complete successfully?
161
173
 
162
174
  If you are uncertain, bring other contributors into the conversation by assigning them as a reviewer.
163
175
 
@@ -1,4 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
  require 'redis'
3
+ require 'connection_pool'
3
4
  config = YAML.safe_load(ERB.new(IO.read(Rails.root.join('config', 'redis.yml'))).result)[Rails.env].with_indifferent_access
4
- Redis.current = Redis.new(config.merge(thread_safe: true))
5
+ config[:thread_safe] = true
6
+
7
+ size = ENV.fetch("HYRAX_REDIS_POOL_SIZE", 5)
8
+ timeout = ENV.fetch("HYRAX_REDIS_TIMEOUT", 5)
9
+
10
+ Hyrax.config.redis_connection =
11
+ ConnectionPool::Wrapper.new(size: size, timeout: timeout) { Redis.new(config) }
data/.regen CHANGED
@@ -1,2 +1,2 @@
1
1
  # When updating CI regen seed, set to current date.
2
- 2022-07-01T00
2
+ 2023-05-15T10:04:07
data/CONTAINERS.md CHANGED
@@ -5,13 +5,13 @@ Our goal is to provide a practical, reusable reference environment for applicati
5
5
 
6
6
  The [Hyrax Engine Development](#hyrax-engine-development) is further along than the [Docker Image for Hyrax-based Applications](#docker-image-for-hyrax-based-applications) which is further along than [Deploying to Production](#deploying-to-production).
7
7
 
8
- There are two options for development environments to run:
8
+ There are two options for development environments to run:
9
9
 
10
10
  - [Dassie](#dassie-internal-test-app-with-activefedora) is the default internal test app that will run an ActiveFedora-based Hyrax web application using Fedora 4 as the backend storage. See [Troubleshooting Dassie](#troubleshooting-dassie) if you encounter any issues.
11
11
  - [Koppie](#koppie-internal-test-app-with-valkyrie-connector-to-postgres) is a newer internal test app that is a Valkyrie-based Hyrax web application that runs with PostGres as backend storage. It does not run ActiveFedora or use Fedora 4. See [Troubleshooting Koppie](#troubleshooting-koppie) if you encounter any issues.
12
12
 
13
13
  <!-- NOTE: This title is referenced in the top-level README.md. Keep that in mind if you change it. -->
14
- ## Hyrax Engine Development
14
+ ## Hyrax Engine Development
15
15
 
16
16
  We support a `docker-compose`-based development environment for folks working on
17
17
  the Hyrax engine. This environment is substantially more like a Hyrax production
@@ -191,7 +191,7 @@ We publish several Hyrax images to the [GitHub container registry][ghcr] under
191
191
  the [Samvera organization][samvera-packages]. To build them:
192
192
 
193
193
  ```sh
194
- export HYRAX_VERSION=v4.0.0.rc1 # or desired version
194
+ export HYRAX_VERSION=v4.0.0.rc3 # or desired version
195
195
  git checkout hyrax-$HYRAX_VERSION
196
196
 
197
197
  docker build --target hyrax-base --tag ghcr.io/samvera/hyrax/hyrax-base:$(git rev-parse HEAD) .
@@ -229,4 +229,4 @@ helm install -n hyrax --set image.tag=(git rev-parse HEAD) dassie chart/hyrax
229
229
  ```
230
230
 
231
231
  [ghcr]: https://docs.github.com/en/enterprise-cloud@latest/packages/working-with-a-github-packages-registry/working-with-the-container-registry
232
- [samvera-packages]: https://github.com/orgs/samvera/packages
232
+ [samvera-packages]: https://github.com/orgs/samvera/packages
data/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- ARG RUBY_VERSION=2.7.7
1
+ ARG RUBY_VERSION=3.2.1
2
2
 
3
3
  # Replace with official jemalloc package in alpine 3.17
4
4
  FROM ruby:$RUBY_VERSION-alpine3.16 as builder
data/README.md CHANGED
@@ -42,7 +42,7 @@ Hyrax offers the ability to:
42
42
 
43
43
  More detailed documentation about Hyrax is available on the [Hyrax Github Wiki](https://github.com/samvera/hyrax/wiki) but if you have questions or need help, please email the [Samvera community tech list](https://samvera.atlassian.net/wiki/spaces/samvera/pages/1171226735/Samvera+Community+Email+Lists#Samvera-Tech-(15-20-messages-per-week-on-average)) or stop by the #dev channel in the [Samvera community Slack team](https://samvera.atlassian.net/wiki/spaces/samvera/pages/405211682/Getting+Started+in+the+Samvera+Community#Join-the-Samvera-Slack-workspace). You can also get in touch with the [Hyrax Maintenance Working Group](https://samvera.atlassian.net/wiki/spaces/samvera/pages/496632295/Hyrax+Maintenance+Working+Group), including the Hyrax Product Owner and Hyrax Tech Lead.
44
44
 
45
- [Reporting Issues](./.github/SUPPORT.md)
45
+ [Reporting Issues](./.github/SUPPORT.md)
46
46
 
47
47
  ## How to Run the Code
48
48
 
@@ -79,4 +79,4 @@ This software has been developed by and is brought to you by the Samvera communi
79
79
 
80
80
  ## License
81
81
 
82
- Hyrax is available under [the Apache 2.0 license](LICENSE).
82
+ Hyrax is available under [the Apache 2.0 license](LICENSE).
@@ -50,7 +50,7 @@ module Hyrax
50
50
  # @return [TrueClass]
51
51
  def attach_files(files, curation_concern, attributes)
52
52
  return true if files.blank?
53
- AttachFilesToWorkJob.perform_later(curation_concern, files, attributes.to_h.symbolize_keys)
53
+ AttachFilesToWorkJob.perform_later(curation_concern, files, **attributes.to_h.symbolize_keys)
54
54
  true
55
55
  end
56
56
 
@@ -12,7 +12,7 @@ class Hyrax::BootstrapBreadcrumbsBuilder < BreadcrumbsOnRails::Breadcrumbs::Buil
12
12
  def render
13
13
  return "" if @elements.blank?
14
14
 
15
- @context.tag.nav(breadcrumbs_options) do
15
+ @context.tag.nav(**breadcrumbs_options) do
16
16
  @context.tag.ol do
17
17
  safe_join(@elements.uniq.collect { |e| render_element(e) })
18
18
  end
@@ -41,7 +41,8 @@ module Hyrax::Controller
41
41
 
42
42
  ##
43
43
  # @note for Blacklight 6/7 compatibility
44
- def search_service(**search_params)
44
+ def search_service(*args, **search_params)
45
+ search_params.merge!(args.last) if args.last.is_a?(Hash)
45
46
  return super if defined?(super) && search_params.empty?
46
47
 
47
48
  search_service_class.new(config: blacklight_config,
@@ -7,8 +7,8 @@ module Hyrax
7
7
  end
8
8
 
9
9
  # TODO: we could remove this if we used an isolated engine
10
- def features_url
11
- hyrax.admin_features_path
10
+ def features_url(*args)
11
+ hyrax.admin_features_path(*args)
12
12
  end
13
13
  end
14
14
  end
@@ -8,7 +8,7 @@ module Hyrax
8
8
  class AdministrativeSetForm < Valkyrie::ChangeSet
9
9
  ##
10
10
  # @api private
11
- AdminSetMembersPopulator = lambda do |_options|
11
+ AdminSetMembersPopulator = lambda do |**_options|
12
12
  self.member_ids =
13
13
  if model.new_record
14
14
  []
@@ -8,7 +8,7 @@ module Hyrax
8
8
  class PcdmCollectionForm < Valkyrie::ChangeSet # rubocop:disable Metrics/ClassLength
9
9
  include Hyrax::FormFields(:core_metadata)
10
10
 
11
- BannerInfoPrepopulator = lambda do |_options|
11
+ BannerInfoPrepopulator = lambda do |**_options|
12
12
  self.banner_info ||= begin
13
13
  banner_info = CollectionBrandingInfo.where(collection_id: id.to_s, role: "banner")
14
14
  banner_file = File.split(banner_info.first.local_path).last unless banner_info.empty?
@@ -19,7 +19,7 @@ module Hyrax
19
19
  end
20
20
  end
21
21
 
22
- LogoInfoPrepopulator = lambda do |_options|
22
+ LogoInfoPrepopulator = lambda do |**_options|
23
23
  self.logo_info ||= begin
24
24
  logos_info = CollectionBrandingInfo.where(collection_id: id.to_s, role: "logo")
25
25
 
@@ -12,7 +12,7 @@ module Hyrax
12
12
  property :proxy_depositor
13
13
 
14
14
  # pcdm relationships
15
- property :admin_set_id, prepopulator: ->(_opts) { self.admin_set_id = Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id.to_s }
15
+ property :admin_set_id, prepopulator: proc { |_opts| self.admin_set_id = Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id.to_s }
16
16
  property :member_ids, default: [], type: Valkyrie::Types::Array
17
17
  property :member_of_collection_ids, default: [], type: Valkyrie::Types::Array
18
18
  property :member_of_collections_attributes, virtual: true, populator: :in_collections_populator
@@ -9,8 +9,8 @@ module Hyrax
9
9
  # names. we provide these as virtual fields and prepopulate these from
10
10
  # `Hyrax::Permission`.
11
11
  class Permission < Hyrax::ChangeSet
12
- property :agent_name, virtual: true, prepopulator: ->(_opts) { self.agent_name = model.agent }
13
- property :access, virtual: true, prepopulator: ->(_opts) { self.access = model.mode }
12
+ property :agent_name, virtual: true, prepopulator: proc { |_opts| self.agent_name = model.agent }
13
+ property :access, virtual: true, prepopulator: proc { |_opts| self.access = model.mode }
14
14
 
15
15
  ##
16
16
  # @note support a {#to_hash} method for compatibility with
@@ -37,7 +37,7 @@ module Hyrax
37
37
  class ResourceForm < Hyrax::ChangeSet # rubocop:disable Metrics/ClassLength
38
38
  ##
39
39
  # @api private
40
- InWorksPrepopulator = lambda do |_options|
40
+ InWorksPrepopulator = proc do |_options|
41
41
  self.in_works_ids =
42
42
  if persisted?
43
43
  Hyrax.query_service
@@ -56,7 +56,7 @@ module Hyrax
56
56
  # with `etag`-driven, application-side lock checks. for non-wings adapters
57
57
  # we want to move away from application side lock validation and rely
58
58
  # on the adapter/database features instead.
59
- LockKeyPrepopulator = lambda do |_options|
59
+ LockKeyPrepopulator = proc do |_options|
60
60
  if Hyrax.config.disable_wings || !Hyrax.metadata_adapter.is_a?(Wings::Valkyrie::MetadataAdapter)
61
61
  Hyrax.logger.info "trying to prepopulate a lock token for " \
62
62
  "#{self.class.inspect}, but optimistic locking isn't " \
@@ -78,26 +78,26 @@ module Hyrax
78
78
 
79
79
  property :date_modified, readable: false
80
80
  property :date_uploaded, readable: false
81
- property :agreement_accepted, virtual: true, default: false, prepopulator: ->(_opts) { self.agreement_accepted = !model.new_record }
81
+ property :agreement_accepted, virtual: true, default: false, prepopulator: proc { |_opts| self.agreement_accepted = !model.new_record }
82
82
 
83
83
  collection(:permissions,
84
84
  virtual: true,
85
85
  default: [],
86
86
  form: Hyrax::Forms::Permission,
87
87
  populator: :permission_populator,
88
- prepopulator: ->(_opts) { self.permissions = Hyrax::AccessControl.for(resource: model).permissions })
88
+ prepopulator: proc { |_opts| self.permissions = Hyrax::AccessControl.for(resource: model).permissions })
89
89
 
90
90
  property :embargo, form: Hyrax::Forms::Embargo, populator: :embargo_populator
91
91
  property :lease, form: Hyrax::Forms::Lease, populator: :lease_populator
92
92
 
93
93
  # virtual properties for embargo/lease;
94
- property :embargo_release_date, virtual: true, prepopulator: ->(_opts) { self.embargo_release_date = model.embargo&.embargo_release_date }
95
- property :visibility_after_embargo, virtual: true, prepopulator: ->(_opts) { self.visibility_after_embargo = model.embargo&.visibility_after_embargo }
96
- property :visibility_during_embargo, virtual: true, prepopulator: ->(_opts) { self.visibility_during_embargo = model.embargo&.visibility_during_embargo }
94
+ property :embargo_release_date, virtual: true, prepopulator: proc { |_opts| self.embargo_release_date = model.embargo&.embargo_release_date }
95
+ property :visibility_after_embargo, virtual: true, prepopulator: proc { |_opts| self.visibility_after_embargo = model.embargo&.visibility_after_embargo }
96
+ property :visibility_during_embargo, virtual: true, prepopulator: proc { |_opts| self.visibility_during_embargo = model.embargo&.visibility_during_embargo }
97
97
 
98
- property :lease_expiration_date, virtual: true, prepopulator: ->(_opts) { self.lease_expiration_date = model.lease&.lease_expiration_date }
99
- property :visibility_after_lease, virtual: true, prepopulator: ->(_opts) { self.visibility_after_lease = model.lease&.visibility_after_lease }
100
- property :visibility_during_lease, virtual: true, prepopulator: ->(_opts) { self.visibility_during_lease = model.lease&.visibility_during_lease }
98
+ property :lease_expiration_date, virtual: true, prepopulator: proc { |_opts| self.lease_expiration_date = model.lease&.lease_expiration_date }
99
+ property :visibility_after_lease, virtual: true, prepopulator: proc { |_opts| self.visibility_after_lease = model.lease&.visibility_after_lease }
100
+ property :visibility_during_lease, virtual: true, prepopulator: proc { |_opts| self.visibility_during_lease = model.lease&.visibility_during_lease }
101
101
 
102
102
  property :in_works_ids, virtual: true, prepopulator: InWorksPrepopulator
103
103
 
@@ -11,9 +11,9 @@ module Hyrax
11
11
  # +EmbargoesControllerBehavior+.
12
12
  class WorkEmbargoForm < Hyrax::ChangeSet
13
13
  property :embargo, form: Hyrax::Forms::Embargo, populator: :embargo_populator, prepopulator: :embargo_populator
14
- property :embargo_release_date, virtual: true, prepopulator: ->(_opts) { self.embargo_release_date = model.embargo&.embargo_release_date }
15
- property :visibility_after_embargo, virtual: true, prepopulator: ->(_opts) { self.visibility_after_embargo = model.embargo&.visibility_after_embargo }
16
- property :visibility_during_embargo, virtual: true, prepopulator: ->(_opts) { self.visibility_during_embargo = model.embargo&.visibility_during_embargo }
14
+ property :embargo_release_date, virtual: true, prepopulator: proc { |_opts| self.embargo_release_date = model.embargo&.embargo_release_date }
15
+ property :visibility_after_embargo, virtual: true, prepopulator: proc { |_opts| self.visibility_after_embargo = model.embargo&.visibility_after_embargo }
16
+ property :visibility_during_embargo, virtual: true, prepopulator: proc { |_opts| self.visibility_during_embargo = model.embargo&.visibility_during_embargo }
17
17
 
18
18
  def embargo_populator(**)
19
19
  self.embargo = Hyrax::EmbargoManager.embargo_for(resource: model)
@@ -11,9 +11,9 @@ module Hyrax
11
11
  # +LeasesControllerBehavior+.
12
12
  class WorkLeaseForm < Hyrax::ChangeSet
13
13
  property :lease, form: Hyrax::Forms::Lease, populator: :lease_populator, prepopulator: :lease_populator
14
- property :lease_expiration_date, virtual: true, prepopulator: ->(_opts) { self.lease_expiration_date = model.lease&.lease_expiration_date }
15
- property :visibility_after_lease, virtual: true, prepopulator: ->(_opts) { self.visibility_after_lease = model.lease&.visibility_after_lease }
16
- property :visibility_during_lease, virtual: true, prepopulator: ->(_opts) { self.visibility_during_lease = model.lease&.visibility_during_lease }
14
+ property :lease_expiration_date, virtual: true, prepopulator: proc { |_opts| self.lease_expiration_date = model.lease&.lease_expiration_date }
15
+ property :visibility_after_lease, virtual: true, prepopulator: proc { |_opts| self.visibility_after_lease = model.lease&.visibility_after_lease }
16
+ property :visibility_during_lease, virtual: true, prepopulator: proc { |_opts| self.visibility_during_lease = model.lease&.visibility_during_lease }
17
17
 
18
18
  def lease_populator(**)
19
19
  self.lease = Hyrax::LeaseManager.lease_for(resource: model)
@@ -3,7 +3,7 @@ module Hyrax
3
3
  module ContentBlockHelperBehavior
4
4
  def displayable_content_block(content_block, **options)
5
5
  return unless display_content_block? content_block
6
- tag.div raw(content_block.value), options
6
+ tag.div(raw(content_block.value), **options)
7
7
  end
8
8
 
9
9
  def display_content_block?(content_block)
@@ -3,7 +3,7 @@ module Hyrax
3
3
  module IiifHelper
4
4
  def iiif_viewer_display(work_presenter, locals = {})
5
5
  render iiif_viewer_display_partial(work_presenter),
6
- locals.merge(presenter: work_presenter)
6
+ **locals.merge(presenter: work_presenter)
7
7
  end
8
8
 
9
9
  def iiif_viewer_display_partial(work_presenter)
@@ -1,18 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  class CollectionBrandingInfo < ApplicationRecord
3
- def initialize(collection_id:,
4
- filename:,
5
- role:,
6
- alt_txt: "",
7
- target_url: "")
8
-
9
- super()
10
- self.collection_id = collection_id
11
- self.role = role
12
- self.alt_text = alt_txt
13
- self.target_url = target_url
14
- self.local_path = File.join(role, filename)
15
- end
3
+ attr_accessor :filename, :alt_txt
4
+ after_initialize :set_collection_attributes
16
5
 
17
6
  def save(file_location, upload_file = true)
18
7
  filename = File.split(local_path).last
@@ -52,6 +41,11 @@ class CollectionBrandingInfo < ApplicationRecord
52
41
 
53
42
  private
54
43
 
44
+ def set_collection_attributes
45
+ self.alt_text ||= alt_txt || ''
46
+ self.local_path ||= File.join(role, filename)
47
+ end
48
+
55
49
  def storage
56
50
  Hyrax.config.branding_storage_adapter
57
51
  end
@@ -204,7 +204,7 @@ module Hyrax
204
204
  interpreted_read_groups = read_groups
205
205
 
206
206
  if interpret_visibility
207
- visibilities = Hyrax::VisibilityMap.instance
207
+ visibilities = Hyrax.config.visibility_map
208
208
  interpreted_read_groups -= visibilities.deletions_for(visibility: collection.visibility)
209
209
  interpreted_read_groups += visibilities.additions_for(visibility: collection.visibility)
210
210
  end
@@ -77,7 +77,7 @@ module Hyrax
77
77
  metadata_fields.map do |field_name|
78
78
  {
79
79
  'label' => I18n.t("simple_form.labels.defaults.#{field_name}"),
80
- 'value' => Array(self[field_name]).map { |value| scrub(value.to_s) }
80
+ 'value' => Array(send(field_name)).map { |value| scrub(value.to_s) }
81
81
  }
82
82
  end
83
83
  end
@@ -44,8 +44,8 @@ module Hyrax
44
44
  end
45
45
 
46
46
  # Query solr using POST so that the query doesn't get too large for a URI
47
- def query(query, args = {})
48
- result = Hyrax::SolrService.post(query, args)
47
+ def query(query, **opts)
48
+ result = Hyrax::SolrService.post(query, **opts)
49
49
  result.fetch('response').fetch('docs')
50
50
  end
51
51
  end
@@ -80,10 +80,7 @@ module Hyrax
80
80
  files =
81
81
  query_service.custom_queries.find_many_file_metadata_by_use(resource: file_set, use: use)
82
82
 
83
- raise Valkyrie::Persistence::ObjectNotFoundError, "FileSet #{file_set.id}'s #{use.fragment} is missing." if
84
- files.empty?
85
-
86
- files.first
83
+ files.first || raise(Valkyrie::Persistence::ObjectNotFoundError, "FileSet #{file_set.id}'s #{use.fragment} is missing.")
87
84
  end
88
85
  end
89
86
  end