OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add some better display of the container
Oliver Günther786122156a8d
diff --git a/app/components/admin/quarantined_attachments/row_component.rb b/app/components/admin/quarantined_attachments/row_component.rbindex 00290d837ba..2f17b4b3b95 100644--- a/app/components/admin/quarantined_attachments/row_component.rb+++ b/app/components/admin/quarantined_attachments/row_component.rb@@ -31,6 +31,9 @@module Adminmodule QuarantinedAttachmentsclass RowComponent < ::RowComponent+ delegate :project, to: :attachment, allow_nil: true+ delegate :container, to: :attachment, allow_nil: true+def attachmentmodelend@@ -43,8 +46,29 @@ module Adminattachment.filenameend- def container- "#{attachment.container_type} ##{attachment.container_id}"+ def attached_to+ description = attachment.description.present? ? "(#{attachment.description})" : ''+ text = "#{container_name} #{attachment.container_id} #{description}"+ case container+ when Message+ helpers.link_to_message(container)+ when WorkPackage+ helpers.link_to_work_package(container)+ when WikiPage+ helpers.link_to(text, project_wiki_path(project, container))+ when User+ helpers.link_to_user(container)+ when MeetingContent+ helpers.link_to(text, meeting_path(container.meeting_id))+ when Grids::Overview+ helpers.link_to(text, project_overview_path(container.project_id))+ else+ text+ end+ end++ def container_name+ container ? container.model_name.human : (attachment.container_type || I18n.t(:label_none))enddef authordiff --git a/app/components/admin/quarantined_attachments/table_component.rb b/app/components/admin/quarantined_attachments/table_component.rbindex 5a84873ddea..f2f2d429b81 100644--- a/app/components/admin/quarantined_attachments/table_component.rb+++ b/app/components/admin/quarantined_attachments/table_component.rb@@ -31,7 +31,7 @@module Adminmodule QuarantinedAttachmentsclass TableComponent < ::TableComponent- columns :filename, :container, :author, :created_at+ columns :filename, :attached_to, :author, :created_atoptions :current_userdef initial_sort@@ -45,7 +45,7 @@ module Admindef headers[['filename', { caption: Attachment.human_attribute_name(:filename) }],- ['container', { caption: I18n.t('antivirus_scan.quarantined_attachments.container') }],+ ['attached_to', { caption: I18n.t('antivirus_scan.quarantined_attachments.container') }],['author', { caption: Attachment.human_attribute_name(:author) }],['created_at', { caption: Attachment.human_attribute_name(:created_at) }]]diff --git a/app/controllers/admin/attachments/quarantined_attachments_controller.rb b/app/controllers/admin/attachments/quarantined_attachments_controller.rbindex 758a303814d..61384011b33 100644--- a/app/controllers/admin/attachments/quarantined_attachments_controller.rb+++ b/app/controllers/admin/attachments/quarantined_attachments_controller.rb@@ -66,7 +66,7 @@ module Admindef find_quarantined_attachments@attachments = Attachment.status_quarantined- .includes(:author)+ .includes(:author, :container)enddef find_attachment