Skip to content

Commit 1dad65f

Browse files
committed
Unset the currently active folder if it gets deleted
1 parent aaf1869 commit 1dad65f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/Client.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,9 @@ public function deleteFolder(string $folder_path, bool $expunge = true): array {
731731
$this->checkConnection();
732732

733733
$folder = $this->getFolderByPath($folder_path);
734+
if ($this->active_folder == $folder->path){
735+
$this->active_folder = null;
736+
}
734737
$status = $this->getConnection()->deleteFolder($folder->path)->validatedData();
735738
if ($expunge) $this->expunge();
736739

src/Folder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,10 @@ public function rename(string $new_name, bool $expunge = true): array {
375375
*/
376376
public function delete(bool $expunge = true): array {
377377
$status = $this->client->getConnection()->deleteFolder($this->path)->validatedData();
378+
if ($this->client->getActiveFolder() == $this->path){
379+
$this->client->setActiveFolder(null);
380+
}
381+
378382
if ($expunge) $this->client->expunge();
379383

380384
$event = $this->getEvent("folder", "deleted");

0 commit comments

Comments
 (0)