From ccce0a7a05ed2680f1656b3911a3af5d8b802dfb Mon Sep 17 00:00:00 2001
From: Steve Taylor <sctaylor@stanford.edu>
Date: Tue, 15 Oct 2024 09:27:47 -0700
Subject: [PATCH 1/2] Pin CI workflow to Ubuntu 22

The Chrome setup action does not currently work with Ubuntu 24.
---
 .github/workflows/ruby.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml
index dc2a83536..41fcc3306 100644
--- a/.github/workflows/ruby.yml
+++ b/.github/workflows/ruby.yml
@@ -7,7 +7,7 @@ on:
 
 jobs:
   test:
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-22.04
     name: test (ruby ${{ matrix.ruby }} / rails ${{ matrix.rails_version }} / blacklight ${{ matrix.blacklight_version }} ${{ matrix.additional_name }})
     strategy:
       matrix:

From d82fcc2074c62c2c7614cfc90cf848e9b6683ec0 Mon Sep 17 00:00:00 2001
From: Steve Taylor <sctaylor@stanford.edu>
Date: Tue, 15 Oct 2024 09:36:08 -0700
Subject: [PATCH 2/2] Rubocop autocorrect

---
 app/models/spotlight/custom_field.rb        | 4 ++--
 app/models/spotlight/custom_search_field.rb | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/app/models/spotlight/custom_field.rb b/app/models/spotlight/custom_field.rb
index ac7a5da1a..bd2003569 100644
--- a/app/models/spotlight/custom_field.rb
+++ b/app/models/spotlight/custom_field.rb
@@ -34,7 +34,7 @@ def label=(label)
     end
 
     def label
-      conf = if field && blacklight_configuration && blacklight_configuration.index_fields.key?(field)
+      conf = if field && blacklight_configuration&.index_fields&.key?(field)
                blacklight_configuration.index_fields[field].reverse_merge(configuration)
              else
                configuration
@@ -74,7 +74,7 @@ def blacklight_configuration
     end
 
     def update_blacklight_configuration_label(label)
-      return unless field && blacklight_configuration && blacklight_configuration.index_fields.key?(field)
+      return unless field && blacklight_configuration&.index_fields&.key?(field)
 
       blacklight_configuration.index_fields[field]['label'] = label
       blacklight_configuration.save
diff --git a/app/models/spotlight/custom_search_field.rb b/app/models/spotlight/custom_search_field.rb
index d8ac37d21..6b5382256 100644
--- a/app/models/spotlight/custom_search_field.rb
+++ b/app/models/spotlight/custom_search_field.rb
@@ -17,7 +17,7 @@ def label=(label)
     end
 
     def label
-      conf = if slug && blacklight_configuration && blacklight_configuration.search_fields.key?(slug)
+      conf = if slug && blacklight_configuration&.search_fields&.key?(slug)
                blacklight_configuration.search_fields[slug].reverse_merge(configuration)
              else
                configuration
@@ -32,7 +32,7 @@ def blacklight_configuration
     end
 
     def update_blacklight_configuration_label(label)
-      return unless slug && blacklight_configuration && blacklight_configuration.search_fields.key?(slug)
+      return unless slug && blacklight_configuration&.search_fields&.key?(slug)
 
       blacklight_configuration.search_fields[slug]['label'] = label
       blacklight_configuration.save