refactor(pj): don't poll on antivirus when submitting a pj

Closes #9733
This commit is contained in:
Colin Darie 2023-12-06 15:10:44 +01:00
parent 189b9e5037
commit 0f1980b1c3
9 changed files with 22 additions and 55 deletions

View file

@ -14,7 +14,7 @@
.fr-py-1v
%span.attachment-filename.fr-mr-1w= link_to_if(viewable?, attachment.filename.to_s, helpers.url_for(attachment.blob), title: t(".open_file", filename: attachment.filename), **helpers.external_link_attributes)
= render Attachment::ProgressComponent.new(attachment: attachment)
= render Attachment::ProgressComponent.new(attachment: attachment, ignore_antivirus: true)
- if error?
%p.fr-error-text= error_message

View file

@ -36,6 +36,6 @@ class Attachment::PendingPollComponent < ApplicationComponent
private
def pending_attachment?(attachment)
attachment.virus_scanner.pending? || attachment.watermark_pending?
attachment.watermark_pending?
end
end

View file

@ -2,6 +2,6 @@
en:
reload: Reload
explanation:
one: Scanning for viruses and processing your attachment takes longer than expected.
other: Scanning for viruses and processing your attachments takes longer than expected.
one: Processing your attachment takes longer than expected.
other: Processing your attachments takes longer than expected.
dossier_submittable: This does not prevent you from submitting your file if you wish.

View file

@ -2,7 +2,7 @@
fr:
reload: Recharger
explanation:
one: Lanalyse antivirus et le traitement de votre pièce jointe prend plus de temps que prévu.
other: Lanalyse antivirus et le traitement de vos pièces jointes prend plus de temps que prévu.
one: Le traitement de votre pièce jointe prend plus de temps que prévu.
other: Le traitement de vos pièces jointes prend plus de temps que prévu.
dossier_submittable: Cela ne vous empêche pas de déposer votre dossier si vous le souhaitez.

View file

@ -1,13 +1,15 @@
class Attachment::ProgressComponent < ApplicationComponent
attr_reader :attachment
attr_reader :ignore_antivirus
def initialize(attachment:)
def initialize(attachment:, ignore_antivirus: false)
@attachment = attachment
@ignore_antivirus = ignore_antivirus
end
def progress_label
case
when attachment.virus_scanner.pending?
when !ignore_antivirus && attachment.virus_scanner.pending?
t(".antivirus_pending")
when attachment.watermark_pending?
t(".watermark_pending")