Skip to content

Commit 18283d3

Browse files
authored
Merge pull request #6375 from samvera/rm-dep-avail-cols
Remove deprecated `available_child_collections` and `available_parent_collections`
2 parents 9061589 + 0429d61 commit 18283d3

File tree

4 files changed

+0
-110
lines changed

4 files changed

+0
-110
lines changed

app/forms/hyrax/forms/collection_form.rb

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,6 @@ def list_child_collections
123123
collection_member_service.available_member_subcollections.documents
124124
end
125125

126-
##
127-
# @deprecated this implementation requires an extra db round trip, had a
128-
# buggy cacheing mechanism, and was largely duplicative of other code.
129-
# all versions of this code are replaced by
130-
# {CollectionsHelper#available_parent_collections_data}.
131-
def available_parent_collections(scope:)
132-
return @available_parents if @available_parents.present?
133-
134-
collection = model_class.find(id)
135-
colls = Hyrax::Collections::NestedCollectionQueryService.available_parent_collections(child: collection, scope: scope, limit_to_id: nil)
136-
@available_parents = colls.map do |col|
137-
{ "id" => col.id, "title_first" => col.title.first }
138-
end.to_json
139-
end
140-
141126
private
142127

143128
def all_files_with_access

app/forms/hyrax/forms/dashboard/nest_collection_form.rb

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -44,40 +44,6 @@ def save
4444
persistence_service.persist_nested_collection_for(parent: parent, child: child, user: context.current_user)
4545
end
4646

47-
##
48-
# @deprecated this method is unused by hyrax, and is effectively a
49-
# delegation to `Hyrax::Collections::NestedCollectionQueryService`.
50-
# if you want to be sure to use nested indexing to generate this list,
51-
# use the query service directly.
52-
#
53-
# For the given parent, what are all of the available collections that
54-
# can be added as sub-collection of the parent.
55-
def available_child_collections
56-
Deprecation.warn "#{self.class}#available_child_collections " \
57-
"is deprecated. the helper of the same name or " \
58-
"Hyrax::Collections::NestedCollectionQueryService " \
59-
"instead."
60-
61-
query_service.available_child_collections(parent: parent, scope: context)
62-
end
63-
64-
##
65-
# @deprecated this method is unused by hyrax, and is effectively a
66-
# delegation to `Hyrax::Collections::NestedCollectionQueryService`.
67-
# if you want to be sure to use nested indexing to generate this list,
68-
# use the query service directly.
69-
#
70-
# For the given child, what are all of the available collections to
71-
# which the child can be added as a sub-collection.
72-
def available_parent_collections
73-
Deprecation.warn "#{self.class}#available_parent_collections " \
74-
"is deprecated. the helper of the same name or " \
75-
"Hyrax::Collections::NestedCollectionQueryService " \
76-
"instead."
77-
78-
query_service.available_parent_collections(child: child, scope: context)
79-
end
80-
8147
# when creating a NEW collection, we need to do some basic validation before
8248
# rerouting to new_dashboard_collection_path to add the new collection as
8349
# a child. Since we don't yet have a child collection, the valid? option can't be used here.

app/presenters/hyrax/collection_presenter.rb

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -172,23 +172,6 @@ def first_work_type
172172
create_work_presenter.first_model
173173
end
174174

175-
##
176-
# @deprecated this implementation requires an extra db round trip, had a
177-
# buggy cacheing mechanism, and was largely duplicative of other code.
178-
# all versions of this code are replaced by
179-
# {CollectionsHelper#available_parent_collections_data}.
180-
def available_parent_collections(scope:)
181-
Deprecation.warn("#{self.class}#available_parent_collections is " \
182-
"deprecated. Use available_parent_collections_data " \
183-
"helper instead.")
184-
return @available_parents if @available_parents.present?
185-
collection = Hyrax.config.collection_class.find(id)
186-
colls = Hyrax::Collections::NestedCollectionQueryService.available_parent_collections(child: collection, scope: scope, limit_to_id: nil)
187-
@available_parents = colls.map do |col|
188-
{ "id" => col.id, "title_first" => col.title.first }
189-
end.to_json
190-
end
191-
192175
def subcollection_count=(total)
193176
@subcollection_count = total unless total.nil?
194177
end

spec/forms/hyrax/forms/dashboard/nest_collection_form_spec.rb

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -96,28 +96,6 @@
9696
end
9797
end
9898

99-
describe '#available_child_collections' do
100-
it 'delegates to the underlying query_service' do
101-
expect(query_service)
102-
.to receive(:available_child_collections)
103-
.with(parent: parent, scope: context)
104-
.and_return(:results)
105-
106-
expect(form.available_child_collections).to eq(:results)
107-
end
108-
end
109-
110-
describe '#available_parent_collections' do
111-
it 'delegates to the underlying query_service' do
112-
expect(query_service)
113-
.to receive(:available_parent_collections)
114-
.with(child: child, scope: context)
115-
.and_return(:results)
116-
117-
expect(form.available_parent_collections).to eq(:results)
118-
end
119-
end
120-
12199
describe '#validate_add' do
122100
context 'when not nestable' do
123101
let(:parent) { double(nestable?: false) }
@@ -255,28 +233,6 @@
255233
end
256234
end
257235

258-
describe '#available_child_collections' do
259-
it 'delegates to the underlying query_service' do
260-
expect(query_service)
261-
.to receive(:available_child_collections)
262-
.with(parent: parent, scope: context)
263-
.and_return(:results)
264-
265-
expect(form.available_child_collections).to eq(:results)
266-
end
267-
end
268-
269-
describe '#available_parent_collections' do
270-
it 'delegates to the underlying query_service' do
271-
expect(query_service)
272-
.to receive(:available_parent_collections)
273-
.with(child: child, scope: context)
274-
.and_return(:results)
275-
276-
expect(form.available_parent_collections).to eq(:results)
277-
end
278-
end
279-
280236
describe '#validate_add' do
281237
context 'when not nestable' do
282238
let(:parent_nestable) { false }

0 commit comments

Comments
 (0)