Revert "feat/5635 - Supprime la possibilité pour l'expert invité d'envoyer un message"

This commit is contained in:
Kara Diaby 2020-10-12 09:24:34 +02:00 committed by GitHub
parent 5165871662
commit 0bd48999bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 67 additions and 1 deletions

View file

@ -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)