From b0aee4eb4205365e19a98729ca467bfec4fbea6f Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 22 Jun 2014 06:28:16 -0400
Subject: [PATCH] Fix bug where non-existing (or unsubscribed) folder wasn't listed in folder selector (#1489956)

---
 plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php |   19 ++++++++++++-------
 plugins/managesieve/Changelog                            |    1 +
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog
index 3755084..c553878 100644
--- a/plugins/managesieve/Changelog
+++ b/plugins/managesieve/Changelog
@@ -1,3 +1,4 @@
+- Fix bug where non-existing (or unsubscribed) folder wasn't listed in folder selector (#1489956)
 - Added optional separate interface for out-of-office management (#1488266)
 - Fix disabled "create filter" action
 - Fix enotify/notify extension handling
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
index 3e3b9be..59e116f 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
@@ -1828,17 +1828,22 @@
         $out .= '</div>';
 
         // mailbox select
-        if ($action['type'] == 'fileinto')
+        if ($action['type'] == 'fileinto') {
             $mailbox = $this->mod_mailbox($action['target'], 'out');
-        else
+            // make sure non-existing (or unsubscribed) mailbox is listed (#1489956)
+            $additional = array($mailbox);
+        }
+        else {
             $mailbox = '';
+        }
 
         $select = $this->rc->folder_selector(array(
-            'realnames' => false,
-            'maxlength' => 100,
-            'id' => 'action_mailbox' . $id,
-            'name' => "_action_mailbox[$id]",
-            'style' => 'display:'.(empty($action['type']) || $action['type'] == 'fileinto' ? 'inline' : 'none')
+            'realnames'  => false,
+            'maxlength'  => 100,
+            'id'         => 'action_mailbox' . $id,
+            'name'       => "_action_mailbox[$id]",
+            'style'      => 'display:'.(empty($action['type']) || $action['type'] == 'fileinto' ? 'inline' : 'none'),
+            'additional' => $additional,
         ));
         $out .= $select->show($mailbox);
         $out .= '</td>';

--
Gitblit v1.9.1