Skip to content

Commit

Permalink
Trash folder might not yet be set here.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Feb 17, 2016
1 parent 1398b71 commit c012cd0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions imp/lib/Prefs/Special/Trash.php
Expand Up @@ -69,7 +69,9 @@ public function display(Horde_Core_Prefs_Ui $ui)

if (!$prefs->isLocked('vfolder') || $imp_search['vtrash']->enabled) {
$view->vtrash = IMP_Mailbox::formTo($imp_search->createSearchId('vtrash'));
$view->vtrash_select = $trash->vtrash;
if ($trash) {
$view->vtrash_select = $trash->vtrash;
}
}

return $view->render('trash');
Expand All @@ -82,12 +84,13 @@ public function update(Horde_Core_Prefs_Ui $ui)
global $injector, $prefs;

$imp_search = $injector->getInstance('IMP_Search');
$curr_vtrash = IMP_Mailbox::getPref(IMP_Mailbox::MBOX_TRASH)->vtrash;
$curr_trash = IMP_Mailbox::getPref(IMP_Mailbox::MBOX_TRASH);
$curr_vtrash = $curr_trash && $curr_trash->vtrash;
$trash = IMP_Mailbox::formFrom($ui->vars->trash);

if (!$prefs->isLocked('vfolder')) {
$vtrash = $imp_search['vtrash'];
$vtrash->enabled = $trash->vtrash;
$vtrash->enabled = $trash && $trash->vtrash;
$imp_search['vtrash'] = $vtrash;
}

Expand All @@ -99,7 +102,7 @@ public function update(Horde_Core_Prefs_Ui $ui)

/* Switching to/from Virtual Trash requires us to expire all currently
* cached mailbox lists (hide deleted status may have changed). */
if ($curr_vtrash || $trash->vtrash) {
if ($curr_vtrash || ($trash && $trash->vtrash)) {
$injector->getInstance('IMP_Factory_MailboxList')->expireAll();
}

Expand Down

0 comments on commit c012cd0

Please sign in to comment.