diff --git a/app/views/new_gestionnaire/dossiers/_header.html.haml b/app/views/new_gestionnaire/dossiers/_header.html.haml index 5d6f36316..acdd37e64 100644 --- a/app/views/new_gestionnaire/dossiers/_header.html.haml +++ b/app/views/new_gestionnaire/dossiers/_header.html.haml @@ -12,7 +12,7 @@ = render partial: "new_gestionnaire/procedures/dossier_actions", locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: current_gestionnaire&.follow?(dossier) } = render partial: "state_button", locals: { dossier: dossier } %ul.tabs - - notifications_summary = dossier.notifications_summary + - notifications_summary = current_gestionnaire.notifications_for_dossier(dossier) %li{ class: current_page?(dossier_path(dossier.procedure, dossier)) ? 'active' : nil } - if notifications_summary[:demande] %span.notifications{ 'aria-label': 'notifications' } diff --git a/app/views/new_gestionnaire/procedures/index.html.haml b/app/views/new_gestionnaire/procedures/index.html.haml index d9f95ad54..224ceb5a3 100644 --- a/app/views/new_gestionnaire/procedures/index.html.haml +++ b/app/views/new_gestionnaire/procedures/index.html.haml @@ -25,7 +25,7 @@ %li %object = link_to(procedure_path(p, statut: 'suivis')) do - - if @notifications_count_per_procedure[p.id].present? + - if current_gestionnaire.notifications_per_procedure[p.id].present? %span.notifications{ 'aria-label': "notifications" } - followed_count = @followed_dossiers_count_per_procedure[p.id] || 0 .stats-number diff --git a/app/views/new_gestionnaire/procedures/show.html.haml b/app/views/new_gestionnaire/procedures/show.html.haml index d8ec7f23c..c1e9dfc49 100644 --- a/app/views/new_gestionnaire/procedures/show.html.haml +++ b/app/views/new_gestionnaire/procedures/show.html.haml @@ -15,7 +15,7 @@ %span.badge= @a_suivre_dossiers.count %li{ class: (@statut == 'suivis') ? 'active' : nil }> - - if @followed_dossiers.with_unread_notifications.present? + - if current_gestionnaire.notifications_for_procedure(@procedure).present? %span.notifications{ 'aria-label': 'notifications' } = link_to(procedure_path(@procedure, statut: 'suivis')) do = t('pluralize.followed', count: @followed_dossiers.count) @@ -27,7 +27,7 @@ %span.badge= @termines_dossiers.count %li{ class: (@statut == 'tous') ? 'active' : nil }> - - if @followed_dossiers.with_unread_notifications.present? + - if current_gestionnaire.notifications_for_procedure(@procedure).present? %span.notifications{ 'aria-label': 'notifications' } = link_to(procedure_path(@procedure, statut: 'tous')) do tous les dossiers @@ -99,7 +99,7 @@ %td.number-col = link_to(dossier_path(@procedure, dossier), class: 'cell-link') do .icon.folder - - if @followed_dossiers.with_unread_notifications.include?(dossier) + - if current_gestionnaire.notifications_for_procedure(@procedure).include?(dossier.id) %span.notifications{ 'aria-label': 'notifications' } = dossier.id diff --git a/spec/views/new_gestionnaire/dossiers/show.html.haml_spec.rb b/spec/views/new_gestionnaire/dossiers/show.html.haml_spec.rb index cd5d6730e..68ad70c78 100644 --- a/spec/views/new_gestionnaire/dossiers/show.html.haml_spec.rb +++ b/spec/views/new_gestionnaire/dossiers/show.html.haml_spec.rb @@ -1,10 +1,12 @@ describe 'new_gestionnaire/dossiers/show.html.haml', type: :view do + let(:current_gestionnaire) { create(:gestionnaire) } let(:individual) { nil } let(:entreprise) { nil } let(:dossier) { create(:dossier, :initiated, entreprise: entreprise, individual: individual) } before do assign(:dossier, dossier) + view.stub(:current_gestionnaire).and_return(current_gestionnaire) render end