refactor(gallery): move methods in private

This commit is contained in:
Eric Leroy-Terquem 2024-09-12 10:52:51 +02:00
parent 3bc232e81e
commit 4f42e00f4e
No known key found for this signature in database
GPG key ID: 53D8FAECEF207605

View file

@ -20,22 +20,6 @@ class Attachment::GalleryItemComponent < ApplicationComponent
from_dossier? ? attachment.record.libelle : 'Pièce jointe au message'
end
def from_dossier?
attachment.record.class.in?([Champs::PieceJustificativeChamp, Champs::TitreIdentiteChamp])
end
def from_messagerie?
attachment.record.is_a?(Commentaire)
end
def from_messagerie_instructeur?
from_messagerie? && attachment.record.instructeur.present?
end
def from_messagerie_usager?
from_messagerie? && attachment.record.instructeur.nil?
end
def origin
case
when from_dossier?
@ -81,4 +65,22 @@ class Attachment::GalleryItemComponent < ApplicationComponent
"fr-badge--new" => seen_at.present? && updated_at&.>(seen_at)
)
end
private
def from_dossier?
attachment.record.class.in?([Champs::PieceJustificativeChamp, Champs::TitreIdentiteChamp])
end
def from_messagerie?
attachment.record.is_a?(Commentaire)
end
def from_messagerie_instructeur?
from_messagerie? && attachment.record.instructeur.present?
end
def from_messagerie_usager?
from_messagerie? && attachment.record.instructeur.nil?
end
end