Merge pull request #6802 from betagouv/US/fix_notifications_regarding_update_champs_piece_justificative
fix(users/champs/piece_justificative#update): ensure to bump dossier.last_champ_updated_at otherwise instructeurs are not notified when user update their piece_justificative
This commit is contained in:
commit
ad91ed362c
2 changed files with 7 additions and 1 deletions
|
@ -14,7 +14,9 @@ class Champs::PieceJustificativeController < ApplicationController
|
|||
def attach_piece_justificative
|
||||
@champ = policy_scope(Champ).find(params[:champ_id])
|
||||
@champ.piece_justificative_file.attach(params[:blob_signed_id])
|
||||
@champ.save
|
||||
save_succeed = @champ.save
|
||||
@champ.dossier.update(last_champ_updated_at: Time.zone.now.utc) if save_succeed
|
||||
save_succeed
|
||||
end
|
||||
|
||||
def attach_piece_justificative_or_retry
|
||||
|
|
|
@ -31,6 +31,10 @@ describe Champs::PieceJustificativeController, type: :controller do
|
|||
expect(response.status).to eq(200)
|
||||
expect(response.body).to include("##{champ.input_group_id}")
|
||||
end
|
||||
|
||||
it 'updates dossier.last_champ_updated_at' do
|
||||
expect { subject }.to change { dossier.reload.last_champ_updated_at }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the file is invalid' do
|
||||
|
|
Loading…
Reference in a new issue