feat(brouillon): index search terms debounced when updating brouillon

This commit is contained in:
Colin Darie 2024-05-13 15:55:39 +02:00
parent e01f5b7993
commit 71c1d7ac9a
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
2 changed files with 12 additions and 0 deletions

View file

@ -296,6 +296,8 @@ module Users
@dossier = dossier_with_champs(pj_template: false) @dossier = dossier_with_champs(pj_template: false)
@errors = update_dossier_and_compute_errors @errors = update_dossier_and_compute_errors
@dossier.index_search_terms_later if @errors.empty?
respond_to do |format| respond_to do |format|
format.turbo_stream do format.turbo_stream do
@to_show, @to_hide, @to_update = champs_to_turbo_update(champs_public_attributes_params, dossier.champs.filter(&:public?)) @to_show, @to_hide, @to_update = champs_to_turbo_update(champs_public_attributes_params, dossier.champs.filter(&:public?))

View file

@ -770,6 +770,16 @@ describe Users::DossiersController, type: :controller do
end end
end end
end end
it "debounce search terms indexation" do
# dossier creation trigger a first indexation and flag,
# so we we have to remove this flag
dossier.debounce_index_search_terms_flag.remove
assert_enqueued_jobs(1, only: DossierIndexSearchTermsJob) do
3.times { patch :update, params: payload, format: :turbo_stream }
end
end
end end
describe '#update en_construction' do describe '#update en_construction' do