Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation warnings due to upgrade #774

Draft
wants to merge 10 commits into
base: develop
Choose a base branch
from
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ if ENV['DEPENDENCIES_NEXT'] && !ENV['DEPENDENCIES_NEXT'].empty?
gem 'willow_sword', git: 'https://github.com/notch8/willow_sword.git'
end
gem 'sidekiq', '~> 6.4.0'
gem 'deprecation_toolkit', '~> 2.0', '>= 2.0.3'
else
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.5'
Expand Down
3 changes: 3 additions & 0 deletions Gemfile_next.lock
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ GEM
declarative (0.0.20)
deprecation (1.1.0)
activesupport
deprecation_toolkit (2.0.3)
activesupport (>= 5.2)
devise (4.9.2)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
Expand Down Expand Up @@ -1138,6 +1140,7 @@ DEPENDENCIES
coffee-rails (~> 4.2)
curb
database_cleaner
deprecation_toolkit (~> 2.0, >= 2.0.3)
devise
devise-guests (~> 0.6)
dotenv-rails
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class CatalogController < ApplicationController
config.view.masonry.partials = [:index]
config.view.slideshow.partials = [:index]
else
config.view.gallery(document_component: Blacklight::Gallery::DocumentComponent)
config.view.masonry(document_component: Blacklight::Gallery::DocumentComponent)
config.view.slideshow(document_component: Blacklight::Gallery::SlideshowComponent)
config.view.gallery!(document_component: Blacklight::Gallery::DocumentComponent)
config.view.masonry!(document_component: Blacklight::Gallery::DocumentComponent)
config.view.slideshow!(document_component: Blacklight::Gallery::SlideshowComponent)
end

config.show.tile_source_field = :content_metadata_image_iiif_info_ssm
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/pushes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def create
def validate_ids
response = {}
@push = Push.new(user: current_user, pushed_id_csv: pushed_id_csv_from_id_field)
response[:error] = @push.errors.values.flatten.join("\n\n") if @push.invalid?
response[:error] = @push.errors.map(&:message).flatten.join("\n\n") if @push.invalid?
render json: response
end

Expand Down
15 changes: 15 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,19 @@ def field_value_for(doc_presenter, field_name)
doc_presenter.field_value(Blacklight::Configuration::Field.new(field: field_name))
end
end

# moving this method out of Blacklight into a helper due to deprecations in Blacklight 8
# most likely the entire facets and date_range_filter partials will need to be re-written
def search_fields
blacklight_config.search_fields.collect do |_key, field_def|
[label_for_search_field(field_def.key), field_def.key] if should_render_field?(field_def)
end.compact
end

# moving this method out of Blacklight into a helper due to deprecations in Blacklight 8
def thumbnail_url(document)
if document.has? blacklight_config.view_config(document_index_view_type).thumbnail_field
document.first(blacklight_config.view_config(document_index_view_type).thumbnail_field)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div id="facet-date_drsim" class="panel-collapse facet-content collapse <%= 'show' if !params['exact_or_range'].blank? %>" aria-labelledby="facet-date_drsim-header">
<div class="card-body">
<%= form_tag search_action_path, :method => :get, id:"date_range_filter_form" do %>
<%= render_hash_as_hidden_fields(search_state.params_for_search.except(:page, :exact_or_range, :after_date, :before_date)) %>
<%= render Blacklight::HiddenSearchStateComponent.new(params: search_state.params_for_search.except(:page, :exact_or_range, :after_date, :before_date)) %>

<!-- Inputs and labels for choosing filtering by exact date or date range -->
<div class="form-group row">
Expand Down
7 changes: 7 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,10 @@ def self.rails_5_1?
Rails.version.start_with? '5.1'
end
end

unless App.rails_5_1?
DeprecationToolkit::Configuration.config do |config|
config.test_runner = :rspec
config.warnings_treated_as_deprecation = [//]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this line so that it excludes deprecation warnings from gems

end
end
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

let(:digital_instantiation_attributes) do
{
main_title: main_title,
location: 'Test Location',
rights_summary: 'My Test Rights summary',
rights_link: 'In Copyright',
Expand Down
1 change: 1 addition & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
require 'capybara/rails'
require 'ams'
require 'webdrivers'
require "deprecation_toolkit/rspec" unless App.rails_5_1?

# Require support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
Expand Down
Loading