From fb162e744551b7b9d719ec719c2daf0050bcead3 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 18 Apr 2014 05:26:07 -0400
Subject: [PATCH] Fix redundant alert message on over-size uploads (#1489817)

---
 CHANGELOG         |    1 +
 program/js/app.js |   20 +++++++++++---------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index cb3a3b6..5f1e90c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -19,6 +19,7 @@
 - Fix lack of translation of special folders in some configurations (#1489799)
 - Fix XSS issue in plain text spellchecker (#1489806)
 - Fix invalid page title for some folders (1489804)
+- Fix redundant alert message on over-size uploads (#1489817)
 
 RELEASE 1.0.0
 -------------
diff --git a/program/js/app.js b/program/js/app.js
index d6403f7..4a52000 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -1074,8 +1074,9 @@
         // Reset the auto-save timer
         clearTimeout(this.save_timer);
 
-        if (!this.upload_file(props || this.gui_objects.uploadform, 'upload')) {
-          alert(this.get_label('selectimportfile'));
+        if (!(flag = this.upload_file(props || this.gui_objects.uploadform, 'upload'))) {
+          if (flag !== false)
+            alert(this.get_label('selectimportfile'));
           aborted = true;
         }
         break;
@@ -1200,12 +1201,15 @@
         break;
 
       case 'import-messages':
-        var form = props || this.gui_objects.importform;
-        var importlock = this.set_busy(true, 'importwait');
+        var form = props || this.gui_objects.importform,
+          importlock = this.set_busy(true, 'importwait');
+
         $('input[name="_unlock"]', form).val(importlock);
-        if (!this.upload_file(form, 'import')) {
+
+        if (!(flag = this.upload_file(form, 'import'))) {
           this.set_busy(false, null, importlock);
-          alert(this.get_label('selectimportfile'));
+          if (flag !== false)
+            alert(this.get_label('selectimportfile'));
           aborted = true;
         }
         break;
@@ -4016,7 +4020,7 @@
   this.upload_file = function(form, action)
   {
     if (!form)
-      return false;
+      return;
 
     // count files and size on capable browser
     var size = 0, numfiles = 0;
@@ -4076,8 +4080,6 @@
       this.gui_objects.attachmentform = form;
       return true;
     }
-
-    return false;
   };
 
   // add file name to attachment list

--
Gitblit v1.9.1