From 01e0fb9e8165b127909033e18bed7a25a366b6b7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Feb 2025 06:16:30 +0000 Subject: [PATCH 01/10] build(deps): bump tom-select from 2.4.1 to 2.4.2 Bumps [tom-select](https://github.com/orchidjs/tom-select) from 2.4.1 to 2.4.2. - [Release notes](https://github.com/orchidjs/tom-select/releases) - [Commits](https://github.com/orchidjs/tom-select/compare/v2.4.1...v2.4.2) --- updated-dependencies: - dependency-name: tom-select dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 13a903936c..e2dc89746f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,7 @@ "select2-bootstrap-5-theme": "^1.3.0", "strftime": "^0.10.3", "sweetalert2": "^11.3.5", - "tom-select": "^2.4.1", + "tom-select": "^2.4.2", "trix": "^2.1.12" }, "devDependencies": { @@ -10091,9 +10091,9 @@ } }, "node_modules/tom-select": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/tom-select/-/tom-select-2.4.1.tgz", - "integrity": "sha512-adI8H8+wk8RRzHYLQ3bXSk2Q+FAq/kzAATrcWlJ2fbIrEzb0VkwaXzKHTAlBwSJrhqbPJvhV/0eypFkED/nAug==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/tom-select/-/tom-select-2.4.2.tgz", + "integrity": "sha512-2RWjkL3gMDz9E+u8w+tQy9JWsYq8gaSytEVeugKYDeMus6ZtxT1HttLPnXsfHCnBPlsNubVyj5gtUeN+S+bcpA==", "license": "Apache-2.0", "dependencies": { "@orchidjs/sifter": "^1.1.0", diff --git a/package.json b/package.json index daf712bb9c..4404487aa6 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "select2-bootstrap-5-theme": "^1.3.0", "strftime": "^0.10.3", "sweetalert2": "^11.3.5", - "tom-select": "^2.4.1", + "tom-select": "^2.4.2", "trix": "^2.1.12" }, "version": "0.1.0", From 1afe6a9e5dc3850b9023b4ec4c73f040210597ca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Feb 2025 06:17:02 +0000 Subject: [PATCH 02/10] build(deps): bump draper from 4.0.2 to 4.0.4 Bumps [draper](https://github.com/drapergem/draper) from 4.0.2 to 4.0.4. - [Release notes](https://github.com/drapergem/draper/releases) - [Changelog](https://github.com/drapergem/draper/blob/master/CHANGELOG.md) - [Commits](https://github.com/drapergem/draper/compare/v4.0.2...v4.0.4) --- updated-dependencies: - dependency-name: draper dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 659353b237..fd09bd758c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -181,7 +181,7 @@ GEM dotenv-rails (3.1.7) dotenv (= 3.1.7) railties (>= 6.1) - draper (4.0.2) + draper (4.0.4) actionpack (>= 5.0) activemodel (>= 5.0) activemodel-serializers-xml (>= 1.0) @@ -391,7 +391,7 @@ GEM pundit (2.4.0) activesupport (>= 3.0.0) racc (1.8.1) - rack (3.1.8) + rack (3.1.9) rack-attack (6.7.0) rack (>= 1.0, < 4) rack-cors (2.0.2) From 030369a9a7495d25f79bbae983c8d5fe284d63b3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Feb 2025 06:17:14 +0000 Subject: [PATCH 03/10] build(deps): bump twilio-ruby from 7.4.2 to 7.4.3 Bumps [twilio-ruby](https://github.com/twilio/twilio-ruby) from 7.4.2 to 7.4.3. - [Release notes](https://github.com/twilio/twilio-ruby/releases) - [Changelog](https://github.com/twilio/twilio-ruby/blob/main/CHANGES.md) - [Commits](https://github.com/twilio/twilio-ruby/compare/7.4.2...7.4.3) --- updated-dependencies: - dependency-name: twilio-ruby dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 659353b237..c5260a8272 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -580,7 +580,7 @@ GEM turbo-rails (2.0.11) actionpack (>= 6.0.0) railties (>= 6.0.0) - twilio-ruby (7.4.2) + twilio-ruby (7.4.3) benchmark faraday (>= 0.9, < 3.0) jwt (>= 1.5, < 3.0) From f079e4c3299679756f0ee13969260f48ca3617de Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Feb 2025 06:17:26 +0000 Subject: [PATCH 04/10] build(deps): bump puma from 6.5.0 to 6.6.0 Bumps [puma](https://github.com/puma/puma) from 6.5.0 to 6.6.0. - [Release notes](https://github.com/puma/puma/releases) - [Changelog](https://github.com/puma/puma/blob/master/History.md) - [Commits](https://github.com/puma/puma/compare/v6.5.0...v6.6.0) --- updated-dependencies: - dependency-name: puma dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index d1509fdcd0..ea5ed27c95 100644 --- a/Gemfile +++ b/Gemfile @@ -36,7 +36,7 @@ gem "paranoia" # For soft-deleting database objects gem "pdf-forms" # filling in fund request PDFs with user input gem "pg" # Use postgresql as the database for Active Record gem "pretender" -gem "puma", "6.5.0" # 6.2.2 fails to install on m1 # Use Puma as the app server +gem "puma", "6.6.0" # 6.2.2 fails to install on m1 # Use Puma as the app server gem "pundit" # for authorization management - based on user.role field gem "rack-attack" # for blocking & throttling abusive requests gem "rack-cors" # for allowing cross-origin resource sharing diff --git a/Gemfile.lock b/Gemfile.lock index 659353b237..6ad4d1f2fa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -386,7 +386,7 @@ GEM date stringio public_suffix (6.0.1) - puma (6.5.0) + puma (6.6.0) nio4r (~> 2.0) pundit (2.4.0) activesupport (>= 3.0.0) @@ -681,7 +681,7 @@ DEPENDENCIES pretender pry pry-byebug - puma (= 6.5.0) + puma (= 6.6.0) pundit rack-attack rack-cors From c38bf1e4b0aed46521a6dfeefe760b6e96653343 Mon Sep 17 00:00:00 2001 From: compwron Date: Fri, 31 Jan 2025 22:17:36 -0800 Subject: [PATCH 05/10] Fix readme badge from yarn to npm --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6d8e4b2f7c..c66aa82cae 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![erb lint](https://github.com/rubyforgood/casa/actions/workflows/erb_lint.yml/badge.svg)](https://github.com/rubyforgood/casa/actions/workflows/erb_lint.yml) [![standardrb lint](https://github.com/rubyforgood/casa/actions/workflows/ruby_lint.yml/badge.svg)](https://github.com/rubyforgood/casa/actions/workflows/ruby_lint.yml) [![brakeman](https://github.com/rubyforgood/casa/workflows/brakeman/badge.svg)](https://github.com/rubyforgood/casa/actions/workflows/security.yml) -[![yarn lint](https://github.com/rubyforgood/casa/actions/workflows/yarn_lint_and_test.yml/badge.svg)](https://github.com/rubyforgood/casa/actions/workflows/yarn_lint_and_test.yml) +[![npm lint](https://github.com/rubyforgood/casa/actions/workflows/npm_lint_and_test.yml/badge.svg)](https://github.com/rubyforgood/casa/actions/workflows/npm_lint_and_test.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/24f3bb10db6afac417e2/maintainability)](https://codeclimate.com/github/rubyforgood/casa/trends/technical_debt) [![Test Coverage](https://api.codeclimate.com/v1/badges/24f3bb10db6afac417e2/test_coverage)](https://codeclimate.com/github/rubyforgood/casa/trends/test_coverage_total) From a7827edf40ae699f12d61acb1fe1c2e1d0c30909 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Feb 2025 11:42:12 +0000 Subject: [PATCH 06/10] build(deps): bump strong_migrations from 2.1.0 to 2.2.0 Bumps [strong_migrations](https://github.com/ankane/strong_migrations) from 2.1.0 to 2.2.0. - [Changelog](https://github.com/ankane/strong_migrations/blob/master/CHANGELOG.md) - [Commits](https://github.com/ankane/strong_migrations/compare/v2.1.0...v2.2.0) --- updated-dependencies: - dependency-name: strong_migrations dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 46f856e287..2c0281fc65 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -571,8 +571,8 @@ GEM stimulus-rails (1.3.4) railties (>= 6.0.0) stringio (3.1.2) - strong_migrations (2.1.0) - activerecord (>= 6.1) + strong_migrations (2.2.0) + activerecord (>= 7) thor (1.3.2) timeout (0.4.3) traceroute (0.8.1) From bfc1d0276120663b0198a62cdbc9c93762de9037 Mon Sep 17 00:00:00 2001 From: kerman07 Date: Sun, 2 Feb 2025 23:29:34 +0100 Subject: [PATCH 07/10] Improve performance of case contacts index action using pagination --- Gemfile | 1 + Gemfile.lock | 2 ++ app/controllers/application_controller.rb | 1 + app/controllers/case_contacts_controller.rb | 11 ++++++----- app/helpers/application_helper.rb | 2 ++ app/views/case_contacts/index.html.erb | 2 ++ config/initializers/pagy.rb | 5 +++++ spec/views/case_contacts/index.html.erb_spec.rb | 2 ++ 8 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 config/initializers/pagy.rb diff --git a/Gemfile b/Gemfile index ea5ed27c95..4f89c598aa 100644 --- a/Gemfile +++ b/Gemfile @@ -32,6 +32,7 @@ gem "net-pop" # needed for ruby upgrade to 3.1.0 https://www.ruby-lang.org/en/ne gem "net-smtp", require: false # needed for ruby upgrade to 3.1.0 for some dang reason gem "noticed" # Notifications gem "oj" # faster JSON parsing 🍊 +gem "pagy" # pagination gem "paranoia" # For soft-deleting database objects gem "pdf-forms" # filling in fund request PDFs with user input gem "pg" # Use postgresql as the database for Active Record diff --git a/Gemfile.lock b/Gemfile.lock index 46f856e287..3e69f497e2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -354,6 +354,7 @@ GEM ostruct (>= 0.2) orm_adapter (0.5.0) ostruct (0.6.1) + pagy (9.3.3) parallel (1.26.3) parallel_tests (4.9.0) parallel @@ -672,6 +673,7 @@ DEPENDENCIES net-smtp noticed oj + pagy parallel_tests paranoia pdf-forms diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e641b457bb..024dd07985 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,6 @@ class ApplicationController < ActionController::Base include Pundit::Authorization + include Pagy::Backend include Organizational include Users::TimeZone diff --git a/app/controllers/case_contacts_controller.rb b/app/controllers/case_contacts_controller.rb index 63955667f9..6b4cb91d64 100644 --- a/app/controllers/case_contacts_controller.rb +++ b/app/controllers/case_contacts_controller.rb @@ -19,7 +19,8 @@ def index } ) || return - case_contacts = CaseContact.case_hash_from_cases(@filterrific.find) + @pagy, @filtered_case_contacts = pagy(@filterrific.find) + case_contacts = CaseContact.case_hash_from_cases(@filtered_case_contacts) case_contacts = case_contacts.select { |k, _v| k == params[:casa_case_id].to_i } if params[:casa_case_id].present? @presenter = CaseContactPresenter.new(case_contacts) @@ -103,12 +104,12 @@ def current_organization_groups end def all_case_contacts - policy_scope(current_organization.case_contacts).includes( + policy_scope(current_organization.case_contacts).preload( :creator, :followups, - :contact_types, - contact_topic_answers: [:contact_topic], - casa_case: [:volunteers] + contact_types: :contact_type_group, + contact_topic_answers: :contact_topic, + casa_case: :volunteers ) end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 306f0af64a..bd23abfbd6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,4 +1,6 @@ module ApplicationHelper + include Pagy::Frontend + def body_class qualified_controller_name = controller.controller_path.tr("/", "-") "#{qualified_controller_name} #{qualified_controller_name}-#{controller.action_name}" diff --git a/app/views/case_contacts/index.html.erb b/app/views/case_contacts/index.html.erb index d1b57b1643..3e1b291ff9 100644 --- a/app/views/case_contacts/index.html.erb +++ b/app/views/case_contacts/index.html.erb @@ -125,6 +125,7 @@ <% end %> + <%= turbo_frame_tag :case_contacts do %> <% @presenter.case_contacts.each do |casa_case_id, data| %>
@@ -156,4 +157,5 @@
<% end %> <% end %> + <%== pagy_bootstrap_nav(@pagy) %> <% end %> diff --git a/config/initializers/pagy.rb b/config/initializers/pagy.rb new file mode 100644 index 0000000000..014ede1d43 --- /dev/null +++ b/config/initializers/pagy.rb @@ -0,0 +1,5 @@ +require "pagy/extras/bootstrap" +require "pagy/extras/size" + +Pagy::DEFAULT[:size] = [1, 3, 3, 1] +Pagy::DEFAULT[:nav_class] = "pagy-bootstrap-nav" diff --git a/spec/views/case_contacts/index.html.erb_spec.rb b/spec/views/case_contacts/index.html.erb_spec.rb index 2f118259ff..6e114cc171 100644 --- a/spec/views/case_contacts/index.html.erb_spec.rb +++ b/spec/views/case_contacts/index.html.erb_spec.rb @@ -3,6 +3,7 @@ RSpec.describe "case_contacts/index", type: :view do let(:user) { build_stubbed(:volunteer) } let(:case_contacts) { CaseContact.all } + let(:pagy) { Pagy.new(count: 0) } let(:filterrific_param_set) do param_set = Filterrific::ParamSet.new(case_contacts, {}) @@ -30,6 +31,7 @@ assign(:current_organization_groups, groups) assign(:filterrific, filterrific_param_set) assign(:presenter, CaseContactPresenter.new(case_contacts)) + assign(:pagy, pagy) render template: "case_contacts/index" end From b9eaa9eeba85400859df7b403e1011d949267c22 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 15:54:53 +0000 Subject: [PATCH 08/10] build(deps): bump net-smtp from 0.5.0 to 0.5.1 Bumps [net-smtp](https://github.com/ruby/net-smtp) from 0.5.0 to 0.5.1. - [Release notes](https://github.com/ruby/net-smtp/releases) - [Changelog](https://github.com/ruby/net-smtp/blob/master/NEWS.md) - [Commits](https://github.com/ruby/net-smtp/compare/v0.5.0...v0.5.1) --- updated-dependencies: - dependency-name: net-smtp dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 13567908f3..a6f0d6f99b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -335,7 +335,7 @@ GEM net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol nio4r (2.7.4) nokogiri (1.18.2) From fe2dde3161b17b118644212814083bcb26d26748 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 15:55:09 +0000 Subject: [PATCH 09/10] build(deps-dev): bump rspec-rails from 7.1.0 to 7.1.1 Bumps [rspec-rails](https://github.com/rspec/rspec-rails) from 7.1.0 to 7.1.1. - [Changelog](https://github.com/rspec/rspec-rails/blob/main/Changelog.md) - [Commits](https://github.com/rspec/rspec-rails/compare/v7.1.0...v7.1.1) --- updated-dependencies: - dependency-name: rspec-rails dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 13567908f3..71a6f9efb5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -443,7 +443,7 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) - rdoc (6.11.0) + rdoc (6.12.0) psych (>= 4.0.0) regexp_parser (2.10.0) reline (0.6.0) @@ -454,7 +454,7 @@ GEM actionpack (>= 5.2) railties (>= 5.2) rexml (3.4.0) - rspec-core (3.13.2) + rspec-core (3.13.3) rspec-support (~> 3.13.0) rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) @@ -462,7 +462,7 @@ GEM rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (7.1.0) + rspec-rails (7.1.1) actionpack (>= 7.0) activesupport (>= 7.0) railties (>= 7.0) From 30ec9692cdfaa6ccb44ca4b49c76d4ec349faee1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 15:55:21 +0000 Subject: [PATCH 10/10] build(deps-dev): bump webmock from 3.24.0 to 3.25.0 Bumps [webmock](https://github.com/bblimke/webmock) from 3.24.0 to 3.25.0. - [Changelog](https://github.com/bblimke/webmock/blob/master/CHANGELOG.md) - [Commits](https://github.com/bblimke/webmock/compare/v3.24.0...v3.25.0) --- updated-dependencies: - dependency-name: webmock dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 13567908f3..006ec5cca7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -605,7 +605,7 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webmock (3.24.0) + webmock (3.25.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0)