avoid performing job if attachment is created on existed blob

This commit is contained in:
Lisa Durand 2024-05-16 12:54:09 +02:00 committed by Eric Leroy-Terquem
parent affb1820d8
commit 7cfd9becc8
No known key found for this signature in database
GPG key ID: ECE60B4C1FA2ABB3

View file

@ -16,7 +16,8 @@ module AttachmentImageProcessorConcern
def process_image
return if blob.nil?
return if blob.attachments.any? { _1.record_type == "Export" }
return if blob.attachments.size > 1
return if blob.attachments.last.record_type == "Export"
ImageProcessorJob.perform_later(blob)
end