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
Warning when enabling
Oliver Günther130efad25e58
diff --git a/app/controllers/admin/settings/virus_scanning_settings_controller.rb b/app/controllers/admin/settings/virus_scanning_settings_controller.rbindex bfb74d7981e..0579c78401d 100644--- a/app/controllers/admin/settings/virus_scanning_settings_controller.rb+++ b/app/controllers/admin/settings/virus_scanning_settings_controller.rb@@ -31,7 +31,8 @@ module Admin::Settingsmenu_item :settings_attachmentsbefore_action :require_ee- before_action :check_clamav, only: %i[update]+ before_action :check_clamav, only: %i[update], if: -> { scan_will_enable? }+ before_action :mark_unscanned_attachments, if: -> { scan_will_enable? }def default_breadcrumbt('settings.antivirus.title')@@ -55,9 +56,12 @@ module Admin::Settingsrender('upsale') unless EnterpriseToken.allows_to?(:virus_scanning)end+ def mark_unscanned_attachments+ @unscanned_attachments = Attachment.status_uploaded+ end+def check_clamav- return if params[:settings].blank?- return if params[:settings][:antivirus_scan_mode] == "disabled"+ return if params.dig(:settings, :antivirus_scan_mode) == 'disabled'service = ::Attachments::ClamAVService.new(params[:settings][:antivirus_scan_mode].to_sym,params[:settings][:antivirus_scan_target])@@ -69,6 +73,10 @@ module Admin::Settingsredirect_to action: :showend+ def scan_will_enable?+ Setting.antivirus_scan_mode == :disabled && params.dig(:settings, :antivirus_scan_mode) != 'disabled'+ end+def success_callback(_call)if Setting.antivirus_scan_mode == :disabled && Attachment.status_quarantined.any?flash[:info] = t('settings.antivirus.remaining_quarantined_files_html',diff --git a/app/views/admin/settings/virus_scanning_settings/_unscanned_dialog.html.erb b/app/views/admin/settings/virus_scanning_settings/_unscanned_dialog.html.erbnew file mode 100644index 00000000000..23cff5f9fde--- /dev/null+++ b/app/views/admin/settings/virus_scanning_settings/_unscanned_dialog.html.erb@@ -0,0 +1,8 @@+<%=+ render(Primer::Alpha::Dialog.new(title: t('settings.antivirus.unscanned.title'))) do |d|+ d.with_header(variant: :large)+ d.with_body do+ "You have not scanned #{attachments.pluck(:filename)}"+ end+ end+%>diff --git a/app/views/admin/settings/virus_scanning_settings/show.html.erb b/app/views/admin/settings/virus_scanning_settings/show.html.erbindex f385158ccf5..de4d95d6868 100644--- a/app/views/admin/settings/virus_scanning_settings/show.html.erb+++ b/app/views/admin/settings/virus_scanning_settings/show.html.erb@@ -28,6 +28,10 @@ See COPYRIGHT and LICENSE files for more details.++#%><%= toolbar title: t(:'settings.antivirus.title') %>+<% if true || (Setting::VirusScanning.enabled? && @unscanned_atachments&.exists?) %>+ <%= render partial: 'unscanned_dialog', locals: { attachments: Attachment.status_uploaded } %>+<% end %>+<%= styled_form_tag(admin_settings_virus_scanning_path,method: :patch,diff --git a/config/locales/en.yml b/config/locales/en.ymlindex de8c49e1149..ae7c44f2172 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -3001,6 +3001,8 @@ en:antivirus:title: "Virus scanning"clamav_ping_failed: "Failed to connect the the ClamAV daemon. Double-check the configuration and try again."+ unscanned:+ title: 'Unscanned attachments'upsale:description: "Ensure uploaded files in OpenProject are scanned for viruses before being accessible by other users."remaining_quarantined_files_html: >