Merge pull request #7125 from betagouv/US/ETQ-instructeur-quand-je-demande-un-avis-je-veux-la-notif
fix(instructeur/dossiers#create_avis): as an instructeur, when I ask an avis, i hope to be notified when the expert give his avis. ⚠️ follow up https://secure.helpscout.net/conversation/1781498732/1963490?folderId=1653799
This commit is contained in:
commit
84a1276a2f
2 changed files with 10 additions and 0 deletions
|
@ -17,6 +17,9 @@ module CreateAvisConcern
|
|||
allowed_dossiers += dossier.linked_dossiers_for(instructeur_or_expert)
|
||||
end
|
||||
|
||||
if (instructeur_or_expert.is_a?(Instructeur)) && !instructeur_or_expert.follows.exists?(dossier: dossier)
|
||||
instructeur_or_expert.follow(dossier)
|
||||
end
|
||||
create_results = Avis.create(
|
||||
expert_emails.flat_map do |email|
|
||||
user = User.create_or_promote_to_expert(email, SecureRandom.hex)
|
||||
|
|
|
@ -509,6 +509,13 @@ describe Instructeurs::DossiersController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'as an instructeur, i auto follow the dossier so I get the notifications' do
|
||||
it 'works' do
|
||||
subject
|
||||
expect(instructeur.followed_dossiers).to match_array([dossier])
|
||||
end
|
||||
end
|
||||
|
||||
context 'email sending' do
|
||||
before do
|
||||
subject
|
||||
|
|
Loading…
Reference in a new issue