dossier: add a notice when some attachments of the dossier were lost
On the 22/01/2020, a technical error on the demarches-simplifees.fr instance made us delete some files attached to some dossiers. This PR adds a warning when browsing a dossier containing attachments that were deleted.
This commit is contained in:
parent
7c60b9dfa8
commit
7ba76c6658
7 changed files with 1061 additions and 12 deletions
|
@ -69,4 +69,27 @@ module DossierHelper
|
|||
dossier.state
|
||||
end
|
||||
end
|
||||
|
||||
# On the 22/01/2020, a technical error on the demarches-simplifees.fr
|
||||
# instance caused some files attached to some dossiers to be deleted.
|
||||
#
|
||||
# This method returns true if the dossier contained attachments
|
||||
# whose files were deleted during this incident.
|
||||
def has_lost_attachments(dossier)
|
||||
if dinum_instance?
|
||||
dossiers_with_lost_attachments_ids.include?(dossier.id)
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def dinum_instance?
|
||||
ENV['APP_HOST']&.ends_with?('demarches-simplifiees.fr')
|
||||
end
|
||||
|
||||
def dossiers_with_lost_attachments_ids
|
||||
@@ids ||= YAML.load_file(Rails.root.join('config', 'dossiers-with-lost-attachments.yml'))
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue