2021-11-15 13:18:10 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Instructeurs
|
|
|
|
class CommentairesController < ProceduresController
|
|
|
|
def destroy
|
2021-11-15 13:53:32 +01:00
|
|
|
result = CommentaireService.soft_delete(current_instructeur, params.permit(:dossier_id, :id))
|
2021-11-15 13:18:10 +01:00
|
|
|
if result.status
|
2021-11-15 14:15:05 +01:00
|
|
|
flash[:notice] = t('views.shared.commentaires.destroy.notice')
|
2021-11-15 13:18:10 +01:00
|
|
|
else
|
2021-11-15 14:15:05 +01:00
|
|
|
flash[:alert] = t('views.shared.commentaires.destroy.alert', reason: result.error_message)
|
2021-11-15 13:18:10 +01:00
|
|
|
end
|
2021-11-15 13:53:32 +01:00
|
|
|
redirect_to(messagerie_instructeur_dossier_path(params[:procedure_id], params[:dossier_id]))
|
2021-11-15 13:18:10 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|