From 695b84bc2c67f19134cfce683f0d3a1dced07e38 Mon Sep 17 00:00:00 2001 From: Paul Arterburn Date: Mon, 15 Jan 2024 08:12:11 -0100 Subject: [PATCH] Don't include loading image in collages for existing photos --- app/jobs/image_collage_job.rb | 4 +++- app/lib/email_processor.rb | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/jobs/image_collage_job.rb b/app/jobs/image_collage_job.rb index aa6a8d88..e04b1ae6 100644 --- a/app/jobs/image_collage_job.rb +++ b/app/jobs/image_collage_job.rb @@ -7,7 +7,9 @@ def perform(entry_id, urls) entry.update(filepicker_url: "https://dabble-me.s3.amazonaws.com/uploading.png") - filestack_collage_url = collage_from_urls(urls + [entry&.image_url_cdn]) + existing_url = entry&.image_url_cdn == "https://dabble-me.s3.amazonaws.com/uploading.png" ? nil : entry&.image_url_cdn + + filestack_collage_url = collage_from_urls(urls + [existing_url]) entry.update(remote_image_url: filestack_collage_url, filepicker_url: nil) end diff --git a/app/lib/email_processor.rb b/app/lib/email_processor.rb index 871930e5..f7a469a2 100644 --- a/app/lib/email_processor.rb +++ b/app/lib/email_processor.rb @@ -125,7 +125,8 @@ def process ImageCollageJob.perform_later(existing_entry.id, image_urls) elsif best_attachment_url.present? existing_entry.update(filepicker_url: "https://dabble-me.s3.amazonaws.com/uploading.png") - existing_entry.remote_image_url = collage_from_urls([best_attachment_url, existing_entry.image_url_cdn]) + existing_image = existing_entry.image_url_cdn == "https://dabble-me.s3.amazonaws.com/uploading.png" ? nil : existing_entry.image_url_cdn + existing_entry.remote_image_url = collage_from_urls([best_attachment_url, existing_image]) existing_entry.filepicker_url = nil end end