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:
parent
2abd93d360
commit
3f439ac07a
5 changed files with 30 additions and 18 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue