diff --git a/CHANGELOG.md b/CHANGELOG.md index 3332c5a7f..d3602e398 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ New entries in this file should aim to provide a meaningful amount of informatio - Bump rubocop from 1.44.1 to 1.56.3 [PR#3207](https://github.com/ualbertalib/jupiter/pull/3207) - Bump rubocop-rails from 2.20.2 to 2.21.0 [PR#3211](https://github.com/ualbertalib/jupiter/pull/3211) - Bump Sidekiq and Sidekiq gems to latest version [PR#3217](https://github.com/ualbertalib/jupiter/pull/3217) +- Bump ransack from 3.2.1 to 4.0.0 [PR#3235](https://github.com/ualbertalib/jupiter/pull/3235) ## [2.5.2] - 2023-08-16 diff --git a/Gemfile b/Gemfile index 3f11e0cc4..fe048d0f5 100644 --- a/Gemfile +++ b/Gemfile @@ -58,7 +58,7 @@ gem 'flipper-ui', '~> 1.0.0' # UI for feature flags gem 'jbuilder' # generate JSON objects gem 'kaminari' # Pagination gem 'paper_trail' # Track object changes -gem 'ransack', '3.2.1' # ActiveRecord search/filter +gem 'ransack', '4.0.0' # ActiveRecord search/filter gem 'redcarpet', '~> 3.6', require: ['redcarpet', 'redcarpet/render_strip'] # Markdown to (X)HTML parser gem 'uuidtools' gem 'voight_kampff', '~> 2.0', require: 'voight_kampff/rails' # bot detection diff --git a/Gemfile.lock b/Gemfile.lock index a9c259e21..e0b75fee3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -438,7 +438,7 @@ GEM thor (~> 1.0) rainbow (3.1.1) rake (13.0.6) - ransack (3.2.1) + ransack (4.0.0) activerecord (>= 6.1.5) activesupport (>= 6.1.5) i18n @@ -673,7 +673,7 @@ DEPENDENCIES puma (~> 6.4) pundit (= 1.1.0) rails (~> 6.1.7) - ransack (= 3.2.1) + ransack (= 4.0.0) rdf (~> 3.2.9) rdf-isomorphic (~> 3.2.1) rdf-n3 (~> 3.2.1) diff --git a/app/models/announcement.rb b/app/models/announcement.rb index 0d23768c1..5c054c425 100644 --- a/app/models/announcement.rb +++ b/app/models/announcement.rb @@ -7,4 +7,12 @@ class Announcement < ApplicationRecord scope :current, -> { where(removed_at: nil).order(created_at: :desc) } scope :past, -> { where.not(removed_at: nil).order(removed_at: :desc) } + def self.ransackable_attributes(_auth_object = nil) + ['message', 'created_at', 'removed_at'] + end + + def self.ransackable_associations(_auth_object = nil) + ['user'] + end + end diff --git a/app/models/batch_ingest.rb b/app/models/batch_ingest.rb index c520ef749..5bdd5027c 100644 --- a/app/models/batch_ingest.rb +++ b/app/models/batch_ingest.rb @@ -16,4 +16,12 @@ class BatchIngest < ApplicationRecord validates :batch_ingest_files, presence: true, length: { maximum: 50 } validates :title, presence: true, uniqueness: { case_sensitive: false } + def self.ransackable_attributes(_auth_object = nil) + ['created_at', 'status', 'title'] + end + + def self.ransackable_associations(_auth_object = nil) + [] + end + end diff --git a/app/models/user.rb b/app/models/user.rb index e0f528b57..b5c43815d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -70,4 +70,12 @@ def flipper_id "User:#{id}" end + def self.ransackable_attributes(_auth_object = nil) + ['admin', 'created_at', 'email', 'last_seen_at', 'name', 'suspended'] + end + + def self.ransackable_associations(_auth_object = nil) + [] + end + end diff --git a/app/views/admin/announcements/_past_announcements.html.erb b/app/views/admin/announcements/_past_announcements.html.erb index 7048fbb86..aec089609 100644 --- a/app/views/admin/announcements/_past_announcements.html.erb +++ b/app/views/admin/announcements/_past_announcements.html.erb @@ -3,7 +3,7 @@