From 7eecf873da8d2f28e20dc8fd0e949e6abc5762b4 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 09 Dec 2013 13:16:14 -0500
Subject: [PATCH] Fix issue where children of selected and collapsed thread were skipped on various actions (#1489457)

---
 program/js/app.js |   36 ++++++++++++++----------------------
 1 files changed, 14 insertions(+), 22 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index c9d0ab9..bad8a2f 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -187,8 +187,6 @@
     if (this.env.permaurl)
       this.enable_command('permaurl', 'extwin', true);
 
-    this.local_storage_prefix = 'roundcube.' + (this.env.user_id || 'anonymous') + '.';
-
     switch (this.task) {
 
       case 'mail':
@@ -2664,20 +2662,7 @@
   // delete selected messages from the current mailbox
   this.delete_messages = function(event)
   {
-    var uid, i, len, trash = this.env.trash_mailbox,
-      list = this.message_list,
-      selection = list ? list.get_selection() : [];
-
-    // exit if no mailbox specified or if selection is empty
-    if (!this.env.uid && !selection.length)
-      return;
-
-    // also select childs of collapsed rows
-    for (i=0, len=selection.length; i<len; i++) {
-      uid = selection[i];
-      if (list.rows[uid].has_children && !list.rows[uid].expanded)
-        list.select_children(uid);
-    }
+    var list = this.message_list, trash = this.env.trash_mailbox;
 
     // if config is set to flag for deletion
     if (this.env.flag_for_deletion) {
@@ -2717,7 +2702,7 @@
     this._with_selected_messages('delete', post_data);
   };
 
-  // Send a specifc move/delete request with UIDs of all selected messages
+  // Send a specific move/delete request with UIDs of all selected messages
   // @private
   this._with_selected_messages = function(action, post_data, lock)
   {
@@ -6845,7 +6830,6 @@
 
           if ((response.action == 'list' || response.action == 'search') && this.message_list) {
             this.msglist_select(this.message_list);
-            this.message_list.resize();
             this.triggerEvent('listupdate', { folder:this.env.mailbox, rowcount:this.message_list.rowcount });
           }
         }
@@ -6856,7 +6840,6 @@
             this.enable_command('search-create', this.env.source == '');
             this.enable_command('search-delete', this.env.search_id);
             this.update_group_commands();
-            this.contact_list.resize();
             this.triggerEvent('listupdate', { folder:this.env.source, rowcount:this.contact_list.rowcount });
           }
         }
@@ -7447,11 +7430,20 @@
     setCookie(name, value, expires, this.env.cookie_path, this.env.cookie_domain, this.env.cookie_secure);
   };
 
+  this.get_local_storage_prefix = function()
+  {
+    if (!this.local_storage_prefix)
+      this.local_storage_prefix = 'roundcube.' + (this.env.user_id || 'anonymous') + '.';
+
+    return this.local_storage_prefix;
+  };
+
   // wrapper for localStorage.getItem(key)
   this.local_storage_get_item = function(key, deflt, encrypted)
   {
+
     // TODO: add encryption
-    var item = localStorage.getItem(this.local_storage_prefix + key);
+    var item = localStorage.getItem(this.get_local_storage_prefix() + key);
     return item !== null ? JSON.parse(item) : (deflt || null);
   };
 
@@ -7459,13 +7451,13 @@
   this.local_storage_set_item = function(key, data, encrypted)
   {
     // TODO: add encryption
-    return localStorage.setItem(this.local_storage_prefix + key, JSON.stringify(data));
+    return localStorage.setItem(this.get_local_storage_prefix() + key, JSON.stringify(data));
   };
 
   // wrapper for localStorage.removeItem(key)
   this.local_storage_remove_item = function(key)
   {
-    return localStorage.removeItem(this.local_storage_prefix + key);
+    return localStorage.removeItem(this.get_local_storage_prefix() + key);
   };
 
 }  // end object rcube_webmail

--
Gitblit v1.9.1