Skip to content

Commit

Permalink
Fixed folder re-read after adding/removing a folder
Browse files Browse the repository at this point in the history
Signed-off-by: Janos SUTO <sj@acts.hu>
jsuto committed Oct 30, 2020
1 parent 4d8be0a commit 2b55fe0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions webui/model/folder/folder.php
Original file line number Diff line number Diff line change
@@ -236,8 +236,8 @@ public function add_folder($name = '') {
$last_id = $this->db->getLastId();
$query = $this->db->query("INSERT INTO " . TABLE_FOLDER_USER . " (id, uid) VALUES(?,?)", array($last_id, $session->get("uid")));

$folders = $session->get("folders");
if(!isset($folders[$last_id])) { array_push($folders, $last_id); $session->set("folders", $folders); }
$folders = $this->get_folder_id_array_for_user($session->get("uid"), $session->get("admin_user"));
$session->set("folders", $folders);
}

return $this->db->countAffected();
@@ -253,8 +253,8 @@ public function remove_folder($id = 0) {
$query = $this->db->query("DELETE FROM " . TABLE_FOLDER . " WHERE id=?", array($id));
$query = $this->db->query("DELETE FROM " . TABLE_FOLDER_USER . " WHERE id=? AND uid=?", array($id, $session->get("uid")));

$folders = $session->get("folders");
if(isset($folders[$id])) { unset($folders[$id]); $session->set("folders", $folders); }
$folders = $this->get_folder_id_array_for_user($session->get("uid"), $session->get("admin_user"));
$session->set("folders", $folders);

// shall we delete the existing message - folder id assignments from folder_message?
}
@@ -264,5 +264,3 @@ public function remove_folder($id = 0) {


}

?>

0 comments on commit 2b55fe0

Please sign in to comment.