2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2024-04-29 16:53:21 +02:00
|
|
|
module BlobImageProcessorConcern
|
2020-12-10 12:50:40 +01:00
|
|
|
def watermark_pending?
|
|
|
|
watermark_required? && !watermark_done?
|
|
|
|
end
|
|
|
|
|
|
|
|
def watermark_done?
|
2022-12-22 17:57:08 +01:00
|
|
|
watermarked_at.present?
|
2020-11-17 16:34:24 +01:00
|
|
|
end
|
|
|
|
|
2024-05-07 16:41:20 +02:00
|
|
|
def representation_required?
|
2024-10-10 11:17:02 +02:00
|
|
|
from_champ? || from_messagerie? || logo? || from_action_text? || from_avis? || from_justificatif_motivation?
|
2020-11-17 16:34:24 +01:00
|
|
|
end
|
2021-03-11 14:42:57 +01:00
|
|
|
|
|
|
|
private
|
|
|
|
|
2024-07-02 18:45:41 +02:00
|
|
|
def from_champ?
|
|
|
|
attachments.any? { _1.record.class == Champs::TitreIdentiteChamp || _1.record.class == Champs::PieceJustificativeChamp }
|
|
|
|
end
|
|
|
|
|
|
|
|
def from_messagerie?
|
|
|
|
attachments.any? { _1.record.class == Commentaire }
|
|
|
|
end
|
|
|
|
|
2024-07-03 18:07:33 +02:00
|
|
|
def logo?
|
|
|
|
attachments.any? { _1.name == 'logo' }
|
|
|
|
end
|
|
|
|
|
2024-08-29 17:30:23 +02:00
|
|
|
def from_action_text?
|
|
|
|
attachments.any? { _1.record.class == ActionText::RichText }
|
|
|
|
end
|
|
|
|
|
2024-10-09 17:41:46 +02:00
|
|
|
def from_avis?
|
|
|
|
attachments.any? { _1.record.class == Avis }
|
|
|
|
end
|
|
|
|
|
2021-03-11 14:42:57 +01:00
|
|
|
def watermark_required?
|
2022-12-22 17:57:08 +01:00
|
|
|
attachments.any? { _1.record.class == Champs::TitreIdentiteChamp }
|
2021-03-11 14:42:57 +01:00
|
|
|
end
|
2024-10-10 11:17:02 +02:00
|
|
|
|
|
|
|
def from_justificatif_motivation?
|
|
|
|
attachments.any? { _1.name == 'justificatif_motivation' }
|
|
|
|
end
|
2020-11-17 16:34:24 +01:00
|
|
|
end
|