Skip to content

Commit 57bce71

Browse files
authored
Merge pull request #3184 from alphagov/content-modelling/ignore-locale-when-queueing-dependencies
Ignore locale when queuing dependencies
2 parents 843848c + 9ef1312 commit 57bce71

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

app/sidekiq/host_content_update_job.rb

+8
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,12 @@ def source_edition_publication_event
4040
def source_edition
4141
@source_edition ||= Document.find_by(content_id:).live
4242
end
43+
44+
def dependencies
45+
Queries::ContentDependencies.new(
46+
content_id:,
47+
locale: Edition::DEFAULT_LOCALE,
48+
content_stores:,
49+
).call
50+
end
4351
end

spec/sidekiq/host_content_update_job_spec.rb

+23
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,27 @@
6363
expect(event.payload[:source_block][:updated_by_user_uid]).to eq(latest_publish_event.user_uid)
6464
expect(event.payload[:message]).to eq("Host content updated by content block update")
6565
end
66+
67+
describe "when the locale is a non-English locale" do
68+
subject(:worker_perform) do
69+
described_class.new.perform(
70+
"content_id" => content_id,
71+
"locale" => "cy",
72+
"content_store" => "Adapters::ContentStore",
73+
"orphaned_content_ids" => [],
74+
)
75+
end
76+
77+
let(:edition_dependee) { double(:edition_dependent, call: []) }
78+
79+
it "searches in the default locale" do
80+
expect(Queries::ContentDependencies).to receive(:new).with(
81+
content_id:,
82+
locale: Edition::DEFAULT_LOCALE,
83+
content_stores: %w[live],
84+
).and_return(edition_dependee)
85+
86+
worker_perform
87+
end
88+
end
6689
end

0 commit comments

Comments
 (0)