From fd58a23e55d829c45199d3d95878f29aa536d203 Mon Sep 17 00:00:00 2001 From: Alex Kriuchykhin Date: Wed, 30 Aug 2023 13:30:12 +0200 Subject: [PATCH] Handle situations when file preview was not yet generated for shared tasks [SCI-9183] (#6106) --- .../my_modules/step_attachments/_file_preview.html.erb | 6 +++--- .../my_modules/step_attachments/_inline.html.erb | 2 +- .../my_modules/step_attachments/_thumbnail.html.erb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/shareable_links/my_modules/step_attachments/_file_preview.html.erb b/app/views/shareable_links/my_modules/step_attachments/_file_preview.html.erb index 1c727a4d5..54018d17d 100644 --- a/app/views/shareable_links/my_modules/step_attachments/_file_preview.html.erb +++ b/app/views/shareable_links/my_modules/step_attachments/_file_preview.html.erb @@ -32,7 +32,7 @@
<% if asset.pdf_previewable? %> <%= render partial: 'shared/pdf_viewer', locals: { asset: asset, report_document: false, shareable_document: true } %> - <% elsif asset.previewable? && asset.large_preview.image.attached? %> + <% elsif asset.previewable? && asset.large_preview&.image&.attached? %> <%= image_tag asset.large_preview.url(expires_in: Constants::URL_SHORT_EXPIRE_TIME.minutes), class: 'asset-image', style: 'opacity: 0' %> @@ -50,7 +50,7 @@ class: "previous-asset shareable-gallery-switcher", data: { id: previous_asset.id } do %> - <% if previous_asset.previewable? && previous_asset.medium_preview.image.attached? %> + <% if previous_asset.previewable? && previous_asset.medium_preview&.image&.attached? %> <%= image_tag previous_asset.medium_preview.url(expires_in: Constants::URL_SHORT_EXPIRE_TIME.minutes), class: 'asset-image', style: 'opacity: 0' %> @@ -67,7 +67,7 @@ <%= link_to '#', class: "next-asset shareable-gallery-switcher", data: { id: next_asset.id } do %> - <% if next_asset.previewable? && next_asset.medium_preview.image.attached? %> + <% if next_asset.previewable? && next_asset.medium_preview&.image&.attached? %> <%= image_tag next_asset.medium_preview.url(expires_in: Constants::URL_SHORT_EXPIRE_TIME.minutes), class: 'asset-image', style: 'opacity: 0' %> diff --git a/app/views/shareable_links/my_modules/step_attachments/_inline.html.erb b/app/views/shareable_links/my_modules/step_attachments/_inline.html.erb index cd9bfab5b..7ff451b33 100644 --- a/app/views/shareable_links/my_modules/step_attachments/_inline.html.erb +++ b/app/views/shareable_links/my_modules/step_attachments/_inline.html.erb @@ -25,7 +25,7 @@
<% if asset.pdf_previewable? %> <%= render partial: 'shared/pdf_viewer', locals: { asset: asset, report_document: false, shareable_document: true } %> - <% elsif asset.previewable? && asset.large_preview.image.attached? %> + <% elsif asset.previewable? && asset.large_preview&.image&.attached? %>
<%= image_tag asset.large_preview.url(expires_in: Constants::URL_SHORT_EXPIRE_TIME.minutes), class: 'asset-preview-image', diff --git a/app/views/shareable_links/my_modules/step_attachments/_thumbnail.html.erb b/app/views/shareable_links/my_modules/step_attachments/_thumbnail.html.erb index 2989ace52..1370e6d1a 100644 --- a/app/views/shareable_links/my_modules/step_attachments/_thumbnail.html.erb +++ b/app/views/shareable_links/my_modules/step_attachments/_thumbnail.html.erb @@ -7,7 +7,7 @@ id: asset.id } do %>
- <% if asset.previewable? && asset.medium_preview.image.attached? %> + <% if asset.previewable? && asset.medium_preview&.image&.attached? %> <%= image_tag asset.medium_preview.url(expires_in: Constants::URL_SHORT_EXPIRE_TIME.minutes), class: 'asset-preview-image', style: 'opacity: 0' %>