DossierController: giving an advice does not remove the notifications
This commit is contained in:
parent
3483ec075b
commit
34a7905828
2 changed files with 12 additions and 1 deletions
|
@ -32,7 +32,11 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
||||||
@headers_private = @champs_private.select { |champ| champ.type_champ == 'header_section' }
|
@headers_private = @champs_private.select { |champ| champ.type_champ == 'header_section' }
|
||||||
end
|
end
|
||||||
|
|
||||||
Notification.where(dossier_id: dossier_id).update_all already_read: true
|
# if the current_gestionnaire does not own the dossier, it is here to give an advice
|
||||||
|
# and it should not remove the notifications
|
||||||
|
if current_gestionnaire.dossiers.find_by(id: dossier_id).present?
|
||||||
|
Notification.where(dossier_id: dossier_id).update_all(already_read: true)
|
||||||
|
end
|
||||||
|
|
||||||
@new_avis = Avis.new(introduction: "Bonjour, merci de me donner votre avis sur ce dossier.")
|
@new_avis = Avis.new(introduction: "Bonjour, merci de me donner votre avis sur ce dossier.")
|
||||||
end
|
end
|
||||||
|
|
|
@ -127,6 +127,13 @@ describe Backoffice::DossiersController, type: :controller do
|
||||||
it { expect(subject.status).to eq(200) }
|
it { expect(subject.status).to eq(200) }
|
||||||
it { expect(subject.body).to include("Votre avis est sollicité sur le dossier") }
|
it { expect(subject.body).to include("Votre avis est sollicité sur le dossier") }
|
||||||
it { expect(subject.body).to_not include("Invitez une personne externe à consulter le dossier et à vous donner un avis sur celui ci.") }
|
it { expect(subject.body).to_not include("Invitez une personne externe à consulter le dossier et à vous donner un avis sur celui ci.") }
|
||||||
|
|
||||||
|
describe 'the notifications are not marked as read' do
|
||||||
|
it do
|
||||||
|
expect(Notification).not_to receive(:where)
|
||||||
|
subject
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue