From 3dd37572ca74306069e0c56e763826075af515e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Mar 2026 09:34:35 +0000 Subject: [PATCH 1/2] Bump immutable from 4.3.7 to 4.3.8 (#3212) Bumps [immutable](https://github.com/immutable-js/immutable-js) from 4.3.7 to 4.3.8. - [Release notes](https://github.com/immutable-js/immutable-js/releases) - [Changelog](https://github.com/immutable-js/immutable-js/blob/main/CHANGELOG.md) - [Commits](https://github.com/immutable-js/immutable-js/compare/v4.3.7...v4.3.8) --- updated-dependencies: - dependency-name: immutable dependency-version: 4.3.8 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index ff3fe1709..9798885e6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2880,9 +2880,9 @@ ignore@^5.1.9: integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== immutable@^4.0.0: - version "4.3.7" - resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.3.7.tgz#c70145fc90d89fb02021e65c84eb0226e4e5a381" - integrity sha512-1hqclzwYwjRDFLjcFxOM5AYkkG0rpFPpr1RLPMEuGczoS7YA8gLhy8SWXYRAA/XwfEHpfo3cw5JGioS32fnMRw== + version "4.3.8" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.3.8.tgz#02d183c7727fb2bb1d5d0380da0d779dce9296a7" + integrity sha512-d/Ld9aLbKpNwyl0KiM2CT1WYvkitQ1TSvmRtkcV8FKStiDoA7Slzgjmb/1G2yhKM1p0XeNOieaTbFZmU1d3Xuw== import-fresh@^3.2.1, import-fresh@^3.3.0: version "3.3.0" From 27cad52e1b6f1afaec346bce84c7af6cab7c2d01 Mon Sep 17 00:00:00 2001 From: Nat Dean-Lewis <94526761+natdeanlewissoftwire@users.noreply.github.com> Date: Thu, 5 Mar 2026 13:51:09 +0000 Subject: [PATCH 2/2] CLDC-4226: Unionise org filter scope (#3209) * CLDC-4226: unionise org filter scope * CLDC-4226: add todo comment * CLDC-4226: respond to comments * CLDC-4226: disambiguate scope again * CLDC-4226: use unscoped in block form --- app/models/log.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models/log.rb b/app/models/log.rb index 195f63ba7..00a178e2b 100644 --- a/app/models/log.rb +++ b/app/models/log.rb @@ -50,7 +50,13 @@ class Log < ApplicationRecord scope :has_old_form_id, -> { where.not(old_form_id: nil) } scope :imported_2023_with_old_form_id, -> { imported.filter_by_year(2023).has_old_form_id } scope :imported_2023, -> { imported.filter_by_year(2023) } - scope :filter_by_organisation, ->(org, _user = nil) { where(owning_organisation: org).or(where(managing_organisation: org)) } + # TODO: CLDC-4273: use .union in filter_by_organisation rather than raw SQL + scope :filter_by_organisation, lambda { |orgs, _user = nil| + owned = unscoped { where(owning_organisation: orgs).select(:id) } + managed = unscoped { where(managing_organisation: orgs).select(:id) } + + where("#{table_name}.id = ANY(ARRAY(#{owned.to_sql} UNION #{managed.to_sql}))") + } scope :filter_by_owning_organisation, ->(owning_organisation, _user = nil) { where(owning_organisation:) } scope :filter_by_managing_organisation, ->(managing_organisation, _user = nil) { where(managing_organisation:) } scope :filter_by_user_text_search, ->(param, user) { where(assigned_to: User.visible(user).search_by(param)) }