Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invisible new created folder in personal space and avoid double jstree selection on creation. #4344

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pages/items.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -1923,6 +1923,9 @@ function(data) {
// Refresh list of folders
refreshVisibleFolders(true);
if ($('#form-folder-add').data('action') === 'add') {
// select new folder on jstree
$('#jstree').jstree('deselect_all');
$('#jstree').jstree('select_node', '#li_' + data.newId);
// Refresh tree
refreshTree(data.newId, true);
// Refresh list of items inside the folder
Expand Down
4 changes: 3 additions & 1 deletion sources/folders.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,9 @@ private function rebuildFolderTree($user_is_admin, $title, $parent_id, $isPerson
$tree = new NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
$tree->rebuild();

SessionManager::addRemoveFromSessionArray('user-accessible_folders', [$newId], 'add');
// Update session visible flolders
$sess_key = $isPersonal ? 'user-personal_folders' : 'user-accessible_folders';
SessionManager::addRemoveFromSessionArray($sess_key, [$newId], 'add');

if ($user_is_admin === 0) {
$this->updateUserFolderCache($tree, $title, $parent_id, $isPersonal, $user_id, $newId);
Expand Down