Bugfix: when moving a folder/mailbox check for parent delimiter

This commit is contained in:
the-djmaze 2024-02-18 14:28:42 +01:00
parent 859b064d39
commit ae4a90bda5

View file

@ -488,8 +488,9 @@ export class FolderModel extends AbstractModel {
rename(nameToEdit, parentName) {
nameToEdit = nameToEdit.trim();
const folder = this,
parentFolder = getFolderFromCacheList(parentName),
oldFullname = folder.fullName,
newFullname = parentName + folder.delimiter + nameToEdit;
newFullname = (parentFolder ? (parentName + parentFolder.delimiter) : '') + nameToEdit;
if (nameToEdit && newFullname != oldFullname) {
Remote.abort('Folders').post('FolderRename', FolderUserStore.foldersRenaming, {
oldName: oldFullname,
@ -508,8 +509,7 @@ export class FolderModel extends AbstractModel {
} else {
removeFolderFromCacheList(folder.fullName);
setFolder(folder);
const parent = getFolderFromCacheList(folder.parentName);
sortFolders(parent ? parent.subFolders : FolderUserStore.folderList);
sortFolders(parentFolder ? parentFolder.subFolders : FolderUserStore.folderList);
}
})
.catch(error => {