From 90a721ee268739ba9d9876d9b19c4bf2604bf4ed Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:29:41 +0000 Subject: [PATCH 1/3] Bump rubocop-govuk from 5.0.2 to 5.0.5 Bumps [rubocop-govuk](https://github.com/alphagov/rubocop-govuk) from 5.0.2 to 5.0.5. - [Changelog](https://github.com/alphagov/rubocop-govuk/blob/main/CHANGELOG.md) - [Commits](https://github.com/alphagov/rubocop-govuk/compare/v5.0.2...v5.0.5) --- updated-dependencies: - dependency-name: rubocop-govuk dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5c76ed3e189..7782c1396a1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -376,7 +376,7 @@ GEM jbuilder (2.13.0) actionview (>= 5.0.0) activesupport (>= 5.0.0) - json (2.8.2) + json (2.9.0) json-schema (4.3.0) addressable (>= 2.8) json_schemer (2.3.0) @@ -742,7 +742,7 @@ GEM term-ansicolor (~> 1.7) thor (>= 0.20, < 2.0) parallel (1.26.3) - parser (3.3.5.0) + parser (3.3.6.0) ast (~> 2.4.1) racc parslet (2.0.0) @@ -835,7 +835,7 @@ GEM redis (4.8.1) redis-client (0.22.2) connection_pool - regexp_parser (2.9.2) + regexp_parser (2.9.3) reline (0.5.12) io-console (~> 0.5) request_store (1.7.0) @@ -864,36 +864,35 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-support (3.13.1) - rubocop (1.64.1) + rubocop (1.69.1) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.31.1, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.36.2, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.3) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.36.2) parser (>= 3.3.1.0) rubocop-capybara (2.21.0) rubocop (~> 1.41) - rubocop-govuk (5.0.2) - rubocop (= 1.64.1) - rubocop-ast (= 1.31.3) + rubocop-govuk (5.0.5) + rubocop (= 1.69.1) + rubocop-ast (= 1.36.2) rubocop-capybara (= 2.21.0) - rubocop-rails (= 2.25.1) + rubocop-rails (= 2.27.0) rubocop-rake (= 0.6.0) - rubocop-rspec (= 3.0.1) - rubocop-rails (2.25.1) + rubocop-rspec (= 3.2.0) + rubocop-rails (2.27.0) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 1.33.0, < 2.0) + rubocop (>= 1.52.0, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) rubocop-rake (0.6.0) rubocop (~> 1.0) - rubocop-rspec (3.0.1) + rubocop-rspec (3.2.0) rubocop (~> 1.61) ruby-progressbar (1.13.0) ruby-rc4 (0.1.5) From a6975babadb1eacc66d96a0c7691dc19c6a024aa Mon Sep 17 00:00:00 2001 From: pezholio Date: Thu, 5 Dec 2024 10:38:11 +0000 Subject: [PATCH 2/3] Apply autofixes --- app/models/republishing_event.rb | 14 +------------- app/presenters/publishing_api/person_presenter.rb | 2 +- .../publishing_api/take_part_presenter.rb | 2 +- app/sidekiq/publishing_api_worker.rb | 1 - .../find_and_replace_embed_codes_service_test.rb | 8 ++++---- 5 files changed, 7 insertions(+), 20 deletions(-) diff --git a/app/models/republishing_event.rb b/app/models/republishing_event.rb index 468da243a6e..a02c605cc74 100644 --- a/app/models/republishing_event.rb +++ b/app/models/republishing_event.rb @@ -17,19 +17,7 @@ class RepublishingEvent < ApplicationRecord validates :content_ids, absence: true, unless: -> { bulk_content_type == "all_documents_by_content_ids" } validate :content_ids_is_a_non_empty_array_of_strings, if: -> { bulk_content_type == "all_documents_by_content_ids" } - enum :bulk_content_type, %i[ - all_documents - all_documents_with_pre_publication_editions - all_documents_with_pre_publication_editions_with_html_attachments - all_documents_with_publicly_visible_editions_with_attachments - all_documents_with_publicly_visible_editions_with_html_attachments - all_individual_pages - all_non_editionable_content - all_published_organisation_about_us_pages - all_by_type - all_documents_by_organisation - all_documents_by_content_ids - ] + enum :bulk_content_type, { all_documents: 0, all_documents_with_pre_publication_editions: 1, all_documents_with_pre_publication_editions_with_html_attachments: 2, all_documents_with_publicly_visible_editions_with_attachments: 3, all_documents_with_publicly_visible_editions_with_html_attachments: 4, all_individual_pages: 5, all_non_editionable_content: 6, all_published_organisation_about_us_pages: 7, all_by_type: 8, all_documents_by_organisation: 9, all_documents_by_content_ids: 10 } def content_ids_is_a_non_empty_array_of_strings return errors.add(:content_ids, "is not an array") unless content_ids.is_a?(Array) diff --git a/app/presenters/publishing_api/person_presenter.rb b/app/presenters/publishing_api/person_presenter.rb index 27126c7d28a..0c83d31afd6 100644 --- a/app/presenters/publishing_api/person_presenter.rb +++ b/app/presenters/publishing_api/person_presenter.rb @@ -36,7 +36,7 @@ def links def details details_hash = {} - if item.image&.all_asset_variants_uploaded? && item.image&.url(:s465) + if item.image&.all_asset_variants_uploaded? && item.image.url(:s465) logger.error("PersonPresenter: Person of ID##{item.id} has image with url '#{item.image&.url(:s465)}'") if item.image.url(:s465).include?("carrierwave-tmp") details_hash[:image] = { url: item.image.url(:s465), alt_text: item.name } end diff --git a/app/presenters/publishing_api/take_part_presenter.rb b/app/presenters/publishing_api/take_part_presenter.rb index 05e45e1ff42..a05b1ec6e74 100644 --- a/app/presenters/publishing_api/take_part_presenter.rb +++ b/app/presenters/publishing_api/take_part_presenter.rb @@ -44,7 +44,7 @@ def details end def image_url - return item.image.url(:s300) if item.image&.all_asset_variants_uploaded? && item.image&.url(:s300) + return item.image.url(:s300) if item.image&.all_asset_variants_uploaded? && item.image.url(:s300) placeholder_image_url end diff --git a/app/sidekiq/publishing_api_worker.rb b/app/sidekiq/publishing_api_worker.rb index e95f8365cd2..d511ab656d2 100644 --- a/app/sidekiq/publishing_api_worker.rb +++ b/app/sidekiq/publishing_api_worker.rb @@ -6,7 +6,6 @@ def perform(model_name, update_type = nil, locale = I18n.default_locale.to_s, bulk_publishing = false) - model = class_for(model_name).unscoped.find_by(id:) return if model.nil? diff --git a/lib/engines/content_block_manager/test/unit/app/services/find_and_replace_embed_codes_service_test.rb b/lib/engines/content_block_manager/test/unit/app/services/find_and_replace_embed_codes_service_test.rb index 7ba41253ed0..e0bbff090e9 100644 --- a/lib/engines/content_block_manager/test/unit/app/services/find_and_replace_embed_codes_service_test.rb +++ b/lib/engines/content_block_manager/test/unit/app/services/find_and_replace_embed_codes_service_test.rb @@ -14,17 +14,17 @@ class ContentBlockManager::FindAndReplaceEmbedCodesServiceTest < ActiveSupport:: document_2.latest_edition = edition_2 document_2.save! - html = """ + html = "

Hello there

#{edition_2.document.embed_code}

#{edition_1.document.embed_code}

- """ + " - expected = """ + expected = "

Hello there

#{edition_2.render}

#{edition_1.render}

- """ + " result = ContentBlockManager::FindAndReplaceEmbedCodesService.call(html) From 2d41dfc023c4d94cc64e936fa2085bd51d9988ce Mon Sep 17 00:00:00 2001 From: pezholio Date: Thu, 5 Dec 2024 10:38:51 +0000 Subject: [PATCH 3/3] Disable `Lint/Void` cop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This code is in a migration, so we don’t want to worry too much about it --- ...0240701080000_migrate_worldwide_organisations_to_editions.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/migrate/20240701080000_migrate_worldwide_organisations_to_editions.rb b/db/migrate/20240701080000_migrate_worldwide_organisations_to_editions.rb index abc52199fc5..516c6179a35 100644 --- a/db/migrate/20240701080000_migrate_worldwide_organisations_to_editions.rb +++ b/db/migrate/20240701080000_migrate_worldwide_organisations_to_editions.rb @@ -341,7 +341,9 @@ def up ## We only want to capture the first create event as a "create", every other draft CIP created should be a "update" ## Otherwise we get "Document created" appear within the history of the draft edition + # rubocop:disable Lint/Void create_exists if version.event == "create" + # rubocop:enable Lint/Void end ## Override the draft edition's timestamps to reflect the draft CIPs we have used to create it