Have the flagCallback handle setting deleted flag when reporting spam
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 17 Dec 2010 09:11:58 +0000 (02:11 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 17 Dec 2010 09:17:39 +0000 (02:17 -0700)
imp/js/dimpbase.js
imp/lib/Ajax/Application.php

index 4b82146..369f256 100644 (file)
@@ -2398,14 +2398,9 @@ var DimpBase = {
             search = this.viewport.createSelection('uid', r.uids);
         }
 
-        if (search.size()) {
-            if (r.remove) {
-                this.viewport.remove(search, { noupdate: r.ViewPort });
-                this._expirePPCache(uids);
-            } else {
-                // Need this to catch spam deletions.
-                this.updateFlag(search, '\\deleted', true);
-            }
+        if (r.remove && search.size()) {
+            this.viewport.remove(search, { noupdate: r.ViewPort });
+            this._expirePPCache(uids);
         }
     },
 
index 0708cff..10e6e7b 100644 (file)
@@ -2028,9 +2028,10 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application
      *   remove - (integer) True if messages should be removed from the
      *            viewport.
      *   uids - (string) The list of messages to delete.
-     * 'ViewPort' - (object) See _viewPortData().
+     * 'flag' - (object) See flagEntry().
      * 'poll' - (array) Mailbox names as the keys, number of unseen messages
      *          as the values.
+     * 'ViewPort' - (object) See _viewPortData().
      * </pre>
      */
     protected function _generateDeleteResult($indices, $change,
@@ -2059,6 +2060,10 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application
             $result->ViewPort->view = $this->_vars->view;
         }
 
+        if (!$del->remove) {
+            $result->flag = $this->flagEntry(array('\\deleted'), true, $indices);
+        }
+
         if ($poll = $this->pollEntry($this->_vars->view)) {
             $result->poll = $poll;
         }