From 1219518268950a0cc63e43eecb2e304b84c77d22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Thu, 1 Jun 2023 14:11:28 +0200 Subject: [PATCH] Convert documents fails #1448 --- lib/tasks/dmsf_convert_documents.rake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/tasks/dmsf_convert_documents.rake b/lib/tasks/dmsf_convert_documents.rake index 80caeb3d..6a11ce40 100644 --- a/lib/tasks/dmsf_convert_documents.rake +++ b/lib/tasks/dmsf_convert_documents.rake @@ -79,7 +79,7 @@ class DmsfConvertDocuments attachments = [] issue.attachments.each do |attachment| @fail = false - create_document_from_attachment(project, folder, attachment, files) + create_document_from_attachment(project, folder, attachment, files, issue) attachments << attachment unless @fail end next unless @dry_run @@ -130,7 +130,7 @@ class DmsfConvertDocuments files = [] @fail = false document.attachments.each do |a| - create_document_from_attachment(project, folder, a, files) + create_document_from_attachment(project, folder, a, files, document) end document.destroy unless @dry_run || @fail end @@ -140,7 +140,7 @@ class DmsfConvertDocuments private - def create_document_from_attachment(project, folder, attachment, files) + def create_document_from_attachment(project, folder, attachment, files, container) file = DmsfFile.new file.project_id = project.id file.dmsf_folder = folder @@ -178,7 +178,7 @@ class DmsfConvertDocuments revision.updated_at = attachment.created_on revision.major_version = 0 revision.minor_version = 1 - revision.comment = "Converted from #{folder.system ? 'Issues' : 'Documents'}" + revision.comment = "Converted from #{container.class.name}" revision.mime_type = attachment.content_type revision.disk_filename = revision.new_storage_filename unless @dry_run