Revert "feat/5635 - Supprime la possibilité pour l'expert invité d'envoyer un message"
This commit is contained in:
parent
5165871662
commit
0bd48999bd
5 changed files with 67 additions and 1 deletions
|
@ -6,7 +6,7 @@ module Instructeurs
|
|||
before_action :check_if_avis_revoked, only: [:show]
|
||||
before_action :redirect_if_no_sign_up_needed, only: [:sign_up]
|
||||
before_action :check_avis_exists_and_email_belongs_to_avis, only: [:sign_up, :create_instructeur]
|
||||
before_action :set_avis_and_dossier, only: [:show, :instruction, :update]
|
||||
before_action :set_avis_and_dossier, only: [:show, :instruction, :messagerie, :create_commentaire, :update]
|
||||
|
||||
A_DONNER_STATUS = 'a-donner'
|
||||
DONNES_STATUS = 'donnes'
|
||||
|
@ -53,6 +53,23 @@ module Instructeurs
|
|||
end
|
||||
end
|
||||
|
||||
def messagerie
|
||||
@commentaire = Commentaire.new
|
||||
end
|
||||
|
||||
def create_commentaire
|
||||
@commentaire = CommentaireService.build(current_instructeur, avis.dossier, commentaire_params)
|
||||
|
||||
if @commentaire.save
|
||||
@commentaire.dossier.update!(last_commentaire_updated_at: Time.zone.now)
|
||||
flash.notice = "Message envoyé"
|
||||
redirect_to messagerie_instructeur_avis_path(avis.procedure, avis)
|
||||
else
|
||||
flash.alert = @commentaire.errors.full_messages
|
||||
render :messagerie
|
||||
end
|
||||
end
|
||||
|
||||
def create_avis
|
||||
@procedure = Procedure.find(params[:procedure_id])
|
||||
if !feature_enabled_for?(:expert_not_allowed_to_invite, @procedure)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue