Add Commentaire.is_sent_by_system? and .is_sent_by(someone)

And use it in CommentaireHelper and in the _message_icon and _message_issuer partials
This commit is contained in:
Nicolas Bouilleaud 2019-07-01 18:14:02 +02:00 committed by Pierre de La Morinerie
parent 2abd93d360
commit 3f439ac07a
5 changed files with 30 additions and 18 deletions

View file

@ -36,6 +36,15 @@ class Commentaire < ApplicationRecord
end
end
def sent_by_system?
[CONTACT_EMAIL, OLD_CONTACT_EMAIL].include?(email) &&
user.nil? && gestionnaire.nil?
end
def sent_by?(someone)
email == someone.email
end
def file_url
if Flipflop.remote_storage?
RemoteDownloader.new(file.path).url