[Rt-commit] rt branch, 4.4-trunk, updated. rt-4.4.1-435-gfb01282

Shawn Moore shawn at bestpractical.com
Mon Jul 3 16:27:49 EDT 2017


The branch, 4.4-trunk has been updated
       via  fb01282ea5e5e709a36dc4d86a54a2782cbeb258 (commit)
       via  949b295f1bb746110221855ebf87c32b86e91347 (commit)
      from  aeb79ac299907881c69b8d856f61988ef7f98279 (commit)

Summary of changes:
 share/html/Elements/JavascriptConfig      | 2 +-
 share/html/Ticket/Elements/AddAttachments | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 949b295f1bb746110221855ebf87c32b86e91347
Author: Felix Brilej <mond.beton at googlemail.com>
Date:   Mon Jun 12 14:52:23 2017 +0200

    Improve user interaction for too-large attachments
    
    The Dropzone Function expects MiB, not bytes, therefore the previous
    "10000" would result in an upload limit of 10GB. Setting the limit to
    what's in $MaxAttachmentSize actually gives the user a feedback that
    their attachment size is too big.

diff --git a/share/html/Elements/JavascriptConfig b/share/html/Elements/JavascriptConfig
index 99dbcf2..46a0f8f 100644
--- a/share/html/Elements/JavascriptConfig
+++ b/share/html/Elements/JavascriptConfig
@@ -49,7 +49,7 @@
 my $Config = {};
 $Config->{$_} = RT->Config->Get( $_, $session{CurrentUser} )
   for qw(rtname WebPath MessageBoxRichText MessageBoxRichTextHeight
-         MessageBoxUseSystemContextMenu);
+         MessageBoxUseSystemContextMenu MaxAttachmentSize);
 
 my $CurrentUser = {};
 if ($session{CurrentUser} and $session{CurrentUser}->id) {
diff --git a/share/html/Ticket/Elements/AddAttachments b/share/html/Ticket/Elements/AddAttachments
index 1531aa2..992eaa0 100644
--- a/share/html/Ticket/Elements/AddAttachments
+++ b/share/html/Ticket/Elements/AddAttachments
@@ -63,13 +63,15 @@
         <div class="dropzone" id="attach-dropzone">
         </div>
 <script type="text/javascript">
+var MaxAttachmentSizeMiB = RT.Config.MaxAttachmentSize/(1024*1024);
+
 Dropzone.autoDiscover = false;
 jQuery( function() {
     var attachDropzone = new Dropzone('#attach-dropzone', {
         url: RT.Config.WebHomePath + '/Helpers/Upload/Add?Token=' + jQuery('#attach-dropzone').closest('form').find('input[name=Token]').val(),
         paramName: "Attach",
         dictDefaultMessage: <% loc("Drop files here or click to attach") |n,j %>,
-        maxFilesize: 10000,
+        maxFilesize: MaxAttachmentSizeMiB,
         previewTemplate: '' +
             '<div class="dz-preview dz-file-preview">' +
             '    <div class="dz-remove-mark pointer-events" data-dz-remove>' +

commit fb01282ea5e5e709a36dc4d86a54a2782cbeb258
Merge: aeb79ac 949b295
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Mon Jul 3 20:27:21 2017 +0000

    Merge branch '4.4/dropzone-max-size' into 4.4-trunk


-----------------------------------------------------------------------


More information about the rt-commit mailing list