Merge pull request #2307 from tchak/fix-do-not-show-email-in-messages-interface

Ne pas afficher les email des gestionnaires dans l'interface de messagerie
This commit is contained in:
gregoirenovel 2018-07-31 15:47:06 +02:00 committed by GitHub
commit 98c92f186b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View file

@ -14,7 +14,13 @@ class Commentaire < ApplicationRecord
after_create :notify
def header
"#{email}, #{I18n.l(created_at.localtime, format: '%d %b %Y %H:%M')}"
"#{sender}, #{I18n.l(created_at.localtime, format: '%d %b %Y %H:%M')}"
end
def sender
if email.present?
email.split('@').first
end
end
def file_url

View file

@ -9,7 +9,7 @@ feature 'users: flux de commentaires' do
let(:champ2) { create(:champ, dossier: dossier, type_de_champ: create(:type_de_champ, libelle: "subtitle")) }
let!(:commentaire1) { create(:commentaire, dossier: dossier, champ: champ1) }
let!(:commentaire2) { create(:commentaire, dossier: dossier) }
let!(:commentaire2) { create(:commentaire, dossier: dossier, email: 'paul.chavard@beta.gouv.fr') }
let!(:commentaire3) { create(:commentaire, dossier: dossier, champ: champ2) }
let!(:commentaire4) { create(:commentaire, dossier: dossier, champ: champ1) }
@ -21,5 +21,7 @@ feature 'users: flux de commentaires' do
scenario "seuls les commentaires généraux sont affichés" do
comments = find(".commentaires")
expect(comments).to have_selector(".content", count: 1)
expect(comments).to have_content('paul.chavard')
expect(comments).not_to have_content('paul.chavard@beta.gouv.fr')
end
end