Fix sort issue with folders

pull/1/head
yflory 4 years ago
parent f3cf848c84
commit 60e9efdd3b

@ -2904,10 +2904,12 @@ define([
var el = useId ? _el : root[_el]; var el = useId ? _el : root[_el];
var sfId = (el && el.root && el.key) ? el.root[el.key] : el; var sfId = (el && el.root && el.key) ? el.root[el.key] : el;
if (folder && el && manager.isSharedFolder(sfId)) { if (folder && el && manager.isSharedFolder(sfId)) {
var title = manager.getSharedFolderData(sfId).title || el; var sfData = manager.getSharedFolderData(sfId);
var title = sfData.title || sfData.lastTitle || el;
return String(title).toLowerCase(); return String(title).toLowerCase();
} else if (folder) { } else if (folder) {
return String((el && el.key) || el).toLowerCase(); console.log(el);
return String((el && el.key) || _el).toLowerCase();
} }
var data = manager.getFileData(el); var data = manager.getFileData(el);
if (!data) { return ''; } if (!data) { return ''; }
@ -2928,6 +2930,7 @@ define([
} }
props[uid] = getProp(k); props[uid] = getProp(k);
}); });
if (folder) { console.error(useId, props); }
keys.sort(function(a, b) { keys.sort(function(a, b) {
var _a = props[(a && a.uid) || a]; var _a = props[(a && a.uid) || a];
var _b = props[(b && b.uid) || b]; var _b = props[(b && b.uid) || b];

@ -926,9 +926,8 @@ define([
if (!resolved.id) { if (!resolved.id) {
var el = Env.user.userObject.find(resolved.path); var el = Env.user.userObject.find(resolved.path);
if (Env.user.userObject.isSharedFolder(el) && Env.folders[el]) { if (Env.user.userObject.isSharedFolder(el) && Env.folders[el]) {
var oldName = Env.folders[el].proxy.metadata.title;
Env.folders[el].proxy.metadata.title = data.newName; Env.folders[el].proxy.metadata.title = data.newName;
Env.user.proxy[UserObject.SHARED_FOLDERS][el].lastTitle = oldName; Env.user.proxy[UserObject.SHARED_FOLDERS][el].lastTitle = data.newName;
return void cb(); return void cb();
} }
} }

Loading…
Cancel
Save