messagerie: generalize the current user email
This commit is contained in:
parent
4e2a5f0b9b
commit
63472f00e6
8 changed files with 11 additions and 12 deletions
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
= render partial: 'header', locals: { avis: @avis, dossier: @dossier }
|
= render partial: 'header', locals: { avis: @avis, dossier: @dossier }
|
||||||
|
|
||||||
= render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_gestionnaire_avis_path(@avis) }
|
= render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, user_email: current_gestionnaire.email, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_gestionnaire_avis_path(@avis) }
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
= render partial: "header", locals: { dossier: @dossier }
|
= render partial: "header", locals: { dossier: @dossier }
|
||||||
|
|
||||||
= render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_gestionnaire_dossier_path(@dossier.procedure, @dossier) }
|
= render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, user_email: current_gestionnaire.email, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_gestionnaire_dossier_path(@dossier.procedure, @dossier) }
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
%ul.messages-list
|
%ul.messages-list
|
||||||
- @dossier.commentaires.each do |commentaire|
|
- @dossier.commentaires.each do |commentaire|
|
||||||
%li
|
%li
|
||||||
= render partial: "new_gestionnaire/shared/messages/message", locals: { commentaire: commentaire, messagerie_seen_at: nil }
|
= render partial: "new_gestionnaire/shared/messages/message", locals: { commentaire: commentaire, user_email: current_gestionnaire.email, messagerie_seen_at: nil }
|
||||||
|
|
||||||
%script{ type: "text/javascript" }
|
%script{ type: "text/javascript" }
|
||||||
window.print();
|
window.print();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
.messagerie.container
|
.messagerie.container
|
||||||
%ul.messages-list
|
%ul.messages-list
|
||||||
- dossier.commentaires.each do |commentaire|
|
- dossier.commentaires.each do |commentaire|
|
||||||
%li{ class: commentaire_is_from_me_class(commentaire, current_gestionnaire.email) }
|
%li{ class: commentaire_is_from_me_class(commentaire, user_email) }
|
||||||
= render partial: "shared/dossiers/messages/message", locals: { commentaire: commentaire, messagerie_seen_at: messagerie_seen_at }
|
= render partial: "shared/dossiers/messages/message", locals: { commentaire: commentaire, user_email: user_email, messagerie_seen_at: messagerie_seen_at }
|
||||||
|
|
||||||
= render partial: "shared/dossiers/messages/form", locals: { commentaire: new_commentaire, form_url: form_url }
|
= render partial: "shared/dossiers/messages/form", locals: { commentaire: new_commentaire, form_url: form_url }
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
= render partial: 'shared/dossiers/messages/message_icon', locals: { commentaire: commentaire, current_gestionnaire: current_gestionnaire }
|
= render partial: 'shared/dossiers/messages/message_icon', locals: { commentaire: commentaire, user_email: user_email }
|
||||||
|
|
||||||
.width-100
|
.width-100
|
||||||
%h2
|
%h2
|
||||||
%span.mail
|
%span.mail
|
||||||
= render partial: 'shared/dossiers/messages/message_issuer', locals: { commentaire: commentaire, current_gestionnaire: current_gestionnaire }
|
= render partial: 'shared/dossiers/messages/message_issuer', locals: { commentaire: commentaire, user_email: user_email }
|
||||||
- if ![current_gestionnaire.email, commentaire.dossier.user.email, OLD_CONTACT_EMAIL, CONTACT_EMAIL].include?(commentaire.email)
|
- if ![user_email, commentaire.dossier.user.email, OLD_CONTACT_EMAIL, CONTACT_EMAIL].include?(commentaire.email)
|
||||||
%span.guest Invité
|
%span.guest Invité
|
||||||
%span.date{ class: highlight_if_unseen_class(messagerie_seen_at, commentaire.created_at) }
|
%span.date{ class: highlight_if_unseen_class(messagerie_seen_at, commentaire.created_at) }
|
||||||
= I18n.l(commentaire.created_at.localtime, format: '%d/%m/%Y à %H:%M ')
|
= I18n.l(commentaire.created_at.localtime, format: '%d/%m/%Y à %H:%M ')
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
- case commentaire.email
|
- case commentaire.email
|
||||||
- when current_gestionnaire.email
|
- when user_email
|
||||||
= image_tag('icons/account-circle.svg', class: 'person-icon')
|
= image_tag('icons/account-circle.svg', class: 'person-icon')
|
||||||
- when OLD_CONTACT_EMAIL
|
- when OLD_CONTACT_EMAIL
|
||||||
- when CONTACT_EMAIL
|
- when CONTACT_EMAIL
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
- case commentaire.email
|
- case commentaire.email
|
||||||
- when current_gestionnaire.email
|
- when user_email
|
||||||
Vous
|
Vous
|
||||||
- when OLD_CONTACT_EMAIL
|
- when OLD_CONTACT_EMAIL
|
||||||
- when CONTACT_EMAIL
|
- when CONTACT_EMAIL
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
describe 'shared/dossiers/messages/message.html.haml', type: :view do
|
describe 'shared/dossiers/messages/message.html.haml', type: :view do
|
||||||
before { view.extend DossierHelper }
|
before { view.extend DossierHelper }
|
||||||
|
|
||||||
subject { render 'shared/dossiers/messages/message.html.haml', commentaire: commentaire, messagerie_seen_at: seen_at, current_gestionnaire: current_gestionnaire }
|
subject { render 'shared/dossiers/messages/message.html.haml', commentaire: commentaire, messagerie_seen_at: seen_at, user_email: dossier.user.email }
|
||||||
|
|
||||||
let(:dossier) { create(:dossier) }
|
let(:dossier) { create(:dossier) }
|
||||||
let(:commentaire) { create(:commentaire, dossier: dossier) }
|
let(:commentaire) { create(:commentaire, dossier: dossier) }
|
||||||
let(:current_gestionnaire) { create(:gestionnaire) }
|
|
||||||
let(:seen_at) { commentaire.created_at + 1.hour }
|
let(:seen_at) { commentaire.created_at + 1.hour }
|
||||||
|
|
||||||
context "with a seen_at after commentaire created_at" do
|
context "with a seen_at after commentaire created_at" do
|
||||||
|
|
Loading…
Reference in a new issue