feat(dossier): display france connect information notice only to instructeur

This commit is contained in:
Eric Leroy-Terquem 2024-03-01 09:50:39 +01:00
parent efa19926e4
commit 125724d416
6 changed files with 16 additions and 10 deletions

View file

@ -338,6 +338,10 @@ ul.dropdown-items {
color: $blue-france-500; color: $blue-france-500;
} }
.account-btn::before { .account-btn {
content: none !important; flex-wrap: wrap;
&::before {
content: none !important;
}
} }

View file

@ -1,8 +1,11 @@
%nav.fr-translate.fr-nav{ role: "navigation", "aria-label"=> t('menu_aria_label', scope: [:layouts]) } %nav.fr-translate.fr-nav{ role: "navigation", "aria-label"=> t('menu_aria_label', scope: [:layouts]) }
.fr-nav__item .fr-nav__item
%button.account-btn.fr-translate__btn.fr-btn{ "aria-controls" => "account", "aria-expanded" => "false", :title => t('my_account', scope: [:layouts]) } %button.account-btn.fr-translate__btn.fr-btn{ "aria-controls" => "account", "aria-expanded" => "false", :title => t('my_account', scope: [:layouts]) }
= " #{current_email}" %span= current_email
%div{ class: "fr-badge fr-badge--sm fr-ml-1w #{color_by_role(nav_bar_profile)}" } - if dossier.present? && dossier&.france_connect_information.present?
%span
 via FranceConnect
%span{ class: "fr-badge fr-badge--sm fr-ml-1w #{color_by_role(nav_bar_profile)}" }
= t("layouts.#{nav_bar_profile}") = t("layouts.#{nav_bar_profile}")
#account.fr-collapse.fr-menu #account.fr-collapse.fr-menu
%ul.fr-menu__list.max-content %ul.fr-menu__list.max-content

View file

@ -34,7 +34,7 @@
%ul.fr-btns-group.flex.align-center %ul.fr-btns-group.flex.align-center
- if instructeur_signed_in? || user_signed_in? - if instructeur_signed_in? || user_signed_in?
%li %li
= render partial: 'layouts/account_dropdown', locals: { nav_bar_profile: nav_bar_profile } = render partial: 'layouts/account_dropdown', locals: { nav_bar_profile: nav_bar_profile, dossier: dossier }
- elsif (request.path != new_user_session_path && request.path !=agent_connect_path) - elsif (request.path != new_user_session_path && request.path !=agent_connect_path)
- if request.path == new_user_registration_path - if request.path == new_user_registration_path
%li %li

View file

@ -1,4 +1,4 @@
- if dossier.france_connect_information.present? - if dossier.france_connect_information.present? && current_user.instructeur? && !current_user.owns_or_invite?(dossier)
- content_for(:notice_info) do - content_for(:notice_info) do
= render partial: "shared/dossiers/france_connect_informations_notice", locals: { user_information: dossier.france_connect_information } = render partial: "shared/dossiers/france_connect_informations_notice", locals: { user_information: dossier.france_connect_information }

View file

@ -1,7 +1,6 @@
- dossier_for_editing = dossier.en_construction? ? dossier.owner_editing_fork : dossier - dossier_for_editing = dossier.en_construction? ? dossier.owner_editing_fork : dossier
- if dossier.france_connect_information.present? && current_user.instructeur? && !current_user.owns_or_invite?(dossier)
- if dossier.france_connect_information.present?
- content_for(:notice_info) do - content_for(:notice_info) do
= render partial: "shared/dossiers/france_connect_informations_notice", locals: { user_information: dossier.france_connect_information } = render partial: "shared/dossiers/france_connect_informations_notice", locals: { user_information: dossier.france_connect_information }

View file

@ -44,8 +44,8 @@ describe 'users/dossiers/demande', type: :view do
render render
end end
it 'fills the individual with the informations from France Connect' do it 'does not fill the individual with the informations from France Connect' do
expect(view.content_for(:notice_info)).to have_text("Le dossier a été déposé par le compte de #{france_connect_information.given_name} #{france_connect_information.family_name}, authentifié par FranceConnect le #{france_connect_information.updated_at.strftime('%d/%m/%Y')}") expect(view.content_for(:notice_info)).not_to have_text("Le dossier a été déposé par le compte de #{france_connect_information.given_name} #{france_connect_information.family_name}, authentifié par FranceConnect le #{france_connect_information.updated_at.strftime('%d/%m/%Y')}")
end end
end end