From b4eb382e26150daa19a7c17f10c23b17add274c3 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 11 Sep 2018 18:36:54 +0200 Subject: [PATCH] Extract a part of #commentaire_is_from_me_class --- app/helpers/commentaire_helper.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/helpers/commentaire_helper.rb b/app/helpers/commentaire_helper.rb index 7a8973dcc..7702e85c6 100644 --- a/app/helpers/commentaire_helper.rb +++ b/app/helpers/commentaire_helper.rb @@ -1,6 +1,6 @@ module CommentaireHelper def commentaire_is_from_me_class(commentaire, connected_user) - if commentaire.email == connected_user.email + if commentaire_is_from_me(commentaire, connected_user) "from-me" end end @@ -14,4 +14,10 @@ module CommentaireHelper template = is_current_year ? :message_date : :message_date_with_year I18n.l(commentaire.created_at.localtime, format: template) end + + private + + def commentaire_is_from_me(commentaire, connected_user) + commentaire.email == connected_user.email + end end