Extract a part of #commentaire_is_from_me_class

This commit is contained in:
Pierre de La Morinerie 2018-09-11 18:36:54 +02:00 committed by gregoirenovel
parent f9230b85b2
commit b4eb382e26

View file

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