]> source.dussan.org Git - redmine.git/commitdiff
Display bulk_download_max_size in human-readable representation (#7056).
authorGo MAEDA <maeda@farend.jp>
Mon, 23 Mar 2020 05:52:40 +0000 (05:52 +0000)
committerGo MAEDA <maeda@farend.jp>
Mon, 23 Mar 2020 05:52:40 +0000 (05:52 +0000)
Patch by Go MAEDA.

git-svn-id: http://svn.redmine.org/redmine/trunk@19609 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/attachments_controller.rb
test/functional/attachments_controller_test.rb

index 7e198d0bbae72a6fbe25aa634776a080e20e1656..a41476f8010d110665788be5fcb4b019183c114e 100644 (file)
@@ -18,6 +18,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 class AttachmentsController < ApplicationController
+  include ActionView::Helpers::NumberHelper
+
   before_action :find_attachment, :only => [:show, :download, :thumbnail, :update, :destroy]
   before_action :find_container, :only => [:edit_all, :update_all, :download_all]
   before_action :find_downloadable_attachments, :only => :download_all
@@ -239,7 +241,7 @@ class AttachmentsController < ApplicationController
     bulk_download_max_size = Setting.bulk_download_max_size.to_i.kilobytes
     if @attachments.sum(&:filesize) > bulk_download_max_size
       flash[:error] = l(:error_bulk_download_size_too_big,
-                        :max_size => bulk_download_max_size.to_i.kilobytes)
+                        :max_size => number_to_human_size(bulk_download_max_size.to_i))
       redirect_to back_url
       return
     end
index 2576f5f7ade6f7b5c32230ba42468d83c639878e..09f98e26af260f1debf853d1f570be64c10a5a5d 100644 (file)
@@ -617,7 +617,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
           :back_url => '/issues/2'
       }
       assert_redirected_to '/issues/2'
-      assert_equal flash[:error], 'These attachments cannot be bulk downloaded because the total file size exceeds the maximum allowed size (0)'
+      assert_equal flash[:error], 'These attachments cannot be bulk downloaded because the total file size exceeds the maximum allowed size (0 Bytes)'
     end
   end