From ca2dc10ee90510d1e8f5774febc751fbb88165f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 16 Apr 2020 11:57:53 +0200 Subject: [PATCH] Simplify method to check an image max size We were converting megabytes to bytes with the `megabytes` method and then adding a `bytes_to_megabytes` method to convert it back to bytes, which is the same as not doing anything at all :). --- app/helpers/imageables_helper.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/helpers/imageables_helper.rb b/app/helpers/imageables_helper.rb index f2ed56b09..16b49caf9 100644 --- a/app/helpers/imageables_helper.rb +++ b/app/helpers/imageables_helper.rb @@ -4,11 +4,7 @@ module ImageablesHelper end def imageable_max_file_size - bytes_to_megabytes(Setting["uploads.images.max_size"].to_i.megabytes) - end - - def bytes_to_megabytes(bytes) - bytes / Numeric::MEGABYTE + Setting["uploads.images.max_size"].to_i end def imageable_accepted_content_types