hyrax 2.7.0 → 2.7.1

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: 0b78347854928dad8c8ee7c063242ffcef844aee8427243009be48ca4ec809c2
4
- data.tar.gz: cc0bf69bb012226fc582822e86d395cce0de87da0d749ee45104cc5c78cfaacd
3
+ metadata.gz: 731a42bde181b39c81b360a8a83ef939a9a01b3bb6e7f8f5e98f1b36da124606
4
+ data.tar.gz: 0bd8f8fd540eff1a6f118d6590713b7bd878b25ac4629c2026ddda6098523c0d
5
5
  SHA512:
6
- metadata.gz: d6ff706b2405317225f143f78f5b1903dbf676d7d0d7846cf1b3d144f530e568792c92184f818b07cabdcd8479b2a5eaf27bbe17a66c08a4b76c67559321fe2b
7
- data.tar.gz: 07cff94f6fd86bc3a796d0a1d1af3879b5acebc4d36017f04b63d593b56c53f2d223851f672f232fbb344042fdd64d75393f281036e19de95527ba5fcb6bab65
6
+ metadata.gz: 312c1d0360bbb528b90612691cbf916d6e8112a824a4b5ed82a109c65abff4e008c47863d75f7d903989da339c90b186e9809ee19f32de277c6a9ae2074ebab7
7
+ data.tar.gz: f6bb151a8727316ee41203ca7e63caa77b38fd27ab38f10404341048d461a1efd22569ca18d894e73432960d77385a0da9d062101cf459dd8d3d517dc1fb2415
@@ -30,10 +30,16 @@ module Hyrax
30
30
  # checking for existing works to avoid rewriting/loading works that are
31
31
  # already attached
32
32
  existing_works = env.curation_concern.member_ids
33
+ boolean_type_caster = ActiveModel::Type::Boolean.new
34
+
33
35
  attributes_collection.each do |attributes|
34
36
  next if attributes['id'].blank?
35
- if existing_works.include?(attributes['id'])
36
- remove(env.curation_concern, attributes['id']) if has_destroy_flag?(attributes)
37
+ if boolean_type_caster.cast(attributes['_destroy'])
38
+ # Likely someone in the UI sought to add the collection, then
39
+ # changed their mind and checked the "delete" checkbox and posted
40
+ # their update.
41
+ next unless existing_works.include?(attributes['id'])
42
+ remove(env.curation_concern, attributes['id'])
37
43
  else
38
44
  add(env, attributes['id'])
39
45
  end
@@ -46,10 +46,15 @@ module Hyrax
46
46
  attributes_collection = attributes_collection.sort_by { |i, _| i.to_i }.map { |_, attributes| attributes }
47
47
  # checking for existing works to avoid rewriting/loading works that are already attached
48
48
  existing_collections = env.curation_concern.member_of_collection_ids
49
+ boolean_type_caster = ActiveModel::Type::Boolean.new
49
50
  attributes_collection.each do |attributes|
50
51
  next if attributes['id'].blank?
51
- if existing_collections.include?(attributes['id'])
52
- remove(env.curation_concern, attributes['id']) if has_destroy_flag?(attributes)
52
+ if boolean_type_caster.cast(attributes['_destroy'])
53
+ # Likely someone in the UI sought to add the collection, then
54
+ # changed their mind and checked the "delete" checkbox and posted
55
+ # their update.
56
+ next unless existing_collections.include?(attributes['id'])
57
+ remove(env.curation_concern, attributes['id'])
53
58
  else
54
59
  add(env, attributes['id'])
55
60
  end
@@ -115,13 +120,6 @@ module Hyrax
115
120
  curation_concern.member_of_collections.delete(collection)
116
121
  end
117
122
 
118
- # Determines if a hash contains a truthy _destroy key.
119
- # rubocop:disable Naming/PredicateName
120
- def has_destroy_flag?(hash)
121
- ActiveFedora::Type::Boolean.new.cast(hash['_destroy'])
122
- end
123
- # rubocop:enable Naming/PredicateName
124
-
125
123
  # Extact a singleton collection id from the collection attributes and save it in env. Later in the actor stack,
126
124
  # in apply_permission_template_actor.rb, `env.attributes[:collection_id]` will be used to apply the
127
125
  # permissions of the collection to the created work. With one and only one collection, the work is seen as
@@ -1,3 +1,3 @@
1
1
  module Hyrax
2
- VERSION = '2.7.0'.freeze
2
+ VERSION = '2.7.1'.freeze
3
3
  end
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.7.0
4
+ version: 2.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2020-02-02 00:00:00.000000000 Z
17
+ date: 2020-04-02 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rails
@@ -2387,8 +2387,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2387
2387
  - !ruby/object:Gem::Version
2388
2388
  version: '0'
2389
2389
  requirements: []
2390
- rubyforge_project:
2391
- rubygems_version: 2.7.6.2
2390
+ rubygems_version: 3.1.2
2392
2391
  signing_key:
2393
2392
  specification_version: 4
2394
2393
  summary: Hyrax is a front-end based on the robust Samvera framework, providing a user