Skip to content

Commit

Permalink
Merge pull request #3184 from alphagov/content-modelling/ignore-local…
Browse files Browse the repository at this point in the history
…e-when-queueing-dependencies

Ignore locale when queuing dependencies
  • Loading branch information
pezholio authored Mar 6, 2025
2 parents 843848c + 9ef1312 commit 57bce71
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/sidekiq/host_content_update_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,12 @@ def source_edition_publication_event
def source_edition
@source_edition ||= Document.find_by(content_id:).live
end

def dependencies
Queries::ContentDependencies.new(
content_id:,
locale: Edition::DEFAULT_LOCALE,
content_stores:,
).call
end
end
23 changes: 23 additions & 0 deletions spec/sidekiq/host_content_update_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,27 @@
expect(event.payload[:source_block][:updated_by_user_uid]).to eq(latest_publish_event.user_uid)
expect(event.payload[:message]).to eq("Host content updated by content block update")
end

describe "when the locale is a non-English locale" do
subject(:worker_perform) do
described_class.new.perform(
"content_id" => content_id,
"locale" => "cy",
"content_store" => "Adapters::ContentStore",
"orphaned_content_ids" => [],
)
end

let(:edition_dependee) { double(:edition_dependent, call: []) }

it "searches in the default locale" do
expect(Queries::ContentDependencies).to receive(:new).with(
content_id:,
locale: Edition::DEFAULT_LOCALE,
content_stores: %w[live],
).and_return(edition_dependee)

worker_perform
end
end
end

0 comments on commit 57bce71

Please sign in to comment.