diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 894af0f6f..4933ea04d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -21,7 +21,7 @@ class ApplicationController < ActionController::Base around_action :switch_locale helper_method :multiple_devise_profile_connect?, :instructeur_signed_in?, :current_instructeur, :current_expert, :expert_signed_in?, - :administrateur_signed_in?, :current_administrateur, :current_account, :localization_enabled?, :set_locale + :administrateur_signed_in?, :current_administrateur, :current_account, :localization_enabled?, :set_locale, :current_expert_not_instructeur? before_action do Current.request_id = request.uuid @@ -62,6 +62,10 @@ class ApplicationController < ActionController::Base current_user&.expert end + def current_expert_not_instructeur? + current_user&.expert? && !current_user&.instructeur? + end + def expert_signed_in? current_expert.present? end diff --git a/app/controllers/instructeurs/dossiers_controller.rb b/app/controllers/instructeurs/dossiers_controller.rb index fe19bb1e9..339b814f2 100644 --- a/app/controllers/instructeurs/dossiers_controller.rb +++ b/app/controllers/instructeurs/dossiers_controller.rb @@ -73,6 +73,8 @@ module Instructeurs @avis = Avis.new if @dossier.procedure.experts_require_administrateur_invitation? @experts_emails = dossier.procedure.experts_procedures.where(revoked_at: nil).map(&:expert).map(&:email).sort + else + @experts_emails = @dossier.procedure.experts.map(&:email).sort end end @@ -81,6 +83,8 @@ module Instructeurs @avis = Avis.new if @dossier.procedure.experts_require_administrateur_invitation? @experts_emails = dossier.procedure.experts_procedures.where(revoked_at: nil).map(&:expert).map(&:email).sort + else + @experts_emails = @dossier.procedure.experts.map(&:email).sort end end diff --git a/app/views/shared/avis/_form.html.haml b/app/views/shared/avis/_form.html.haml index 78d468b8e..43f3dad28 100644 --- a/app/views/shared/avis/_form.html.haml +++ b/app/views/shared/avis/_form.html.haml @@ -13,7 +13,7 @@ = hidden_field_tag 'avis[emails]', nil .fr-input-group = react_component("ComboMultiple", - options: @dossier.procedure.experts_require_administrateur_invitation ? @experts_emails : [], + options: current_expert_not_instructeur? ? [] : @experts_emails, selected: [], disabled: [], label: 'Emails', group: '.ask-avis',