refactor: remove Spanish folder naming convention, keep English only

Remove all 'Mi Carpeta - ' references from backend and frontend.
Only 'My Folder - {username}' is now recognized as the home folder
naming convention.
This commit is contained in:
Dionisio
2026-02-13 22:33:27 +01:00
parent 05135529ce
commit 5771d82b21
3 changed files with 11 additions and 19 deletions
@@ -97,14 +97,13 @@ impl FolderHandler {
/// Checks if a folder name matches the user home-folder convention. /// Checks if a folder name matches the user home-folder convention.
fn is_user_home_folder(folder_name: &str) -> bool { fn is_user_home_folder(folder_name: &str) -> bool {
folder_name.starts_with("My Folder - ") || folder_name.starts_with("Mi Carpeta - ") folder_name.starts_with("My Folder - ")
} }
/// Checks if a folder belongs to the given user. /// Checks if a folder belongs to the given user.
fn folder_belongs_to_user(folder_name: &str, username: &str) -> bool { fn folder_belongs_to_user(folder_name: &str, username: &str) -> bool {
let expected_en = format!("My Folder - {}", username); let expected = format!("My Folder - {}", username);
let expected_es = format!("Mi Carpeta - {}", username); folder_name == expected
folder_name == expected_en || folder_name == expected_es
} }
/// Lists folders, optionally filtered by parent ID /// Lists folders, optionally filtered by parent ID
+7 -14
View File
@@ -754,10 +754,8 @@ async function loadFiles(options = {}) {
return false; return false;
} }
// Skip other users' folders when at root (both naming conventions) // Skip other users' folders when at root
if (!app.currentPath && if (!app.currentPath && folder.name.startsWith('My Folder - ') && !folder.name.includes(username)) {
(folder.name.startsWith('My Folder - ') || folder.name.startsWith('Mi Carpeta - ')) &&
!folder.name.includes(username)) {
return false; return false;
} }
@@ -1837,9 +1835,7 @@ async function findUserHomeFolder(username) {
console.log(`Found ${folderList.length} folders at root`); console.log(`Found ${folderList.length} folders at root`);
// Look for a folder with a name pattern that matches the user's home folder // Look for a folder with a name pattern that matches the user's home folder
// Match both naming conventions (English and Spanish) const homeFolderPattern = `My Folder - ${username}`;
const homeFolderPatternEn = `My Folder - ${username}`;
const homeFolderPatternEs = `Mi Carpeta - ${username}`;
// Filter first to remove system folders and other users' folders // Filter first to remove system folders and other users' folders
const visibleFolders = folderList.filter(folder => { const visibleFolders = folderList.filter(folder => {
@@ -1848,19 +1844,16 @@ async function findUserHomeFolder(username) {
return false; return false;
} }
// Skip other users' home folders (both naming conventions) // Skip other users' home folders
if ((folder.name.startsWith('Mi Carpeta - ') || folder.name.startsWith('My Folder - ')) if (folder.name.startsWith('My Folder - ') && !folder.name.includes(username)) {
&& !folder.name.includes(username)) {
return false; return false;
} }
return true; return true;
}); });
// Find the user's home folder from filtered list (try both patterns) // Find the user's home folder from filtered list
let homeFolder = visibleFolders.find(folder => let homeFolder = visibleFolders.find(folder => folder.name === homeFolderPattern);
folder.name === homeFolderPatternEn || folder.name === homeFolderPatternEs
);
if (homeFolder) { if (homeFolder) {
console.log(`Found user's home folder: ${homeFolder.name} (${homeFolder.id})`); console.log(`Found user's home folder: ${homeFolder.name} (${homeFolder.id})`);
+1 -1
View File
@@ -394,7 +394,7 @@ const ui = {
if (isUserHomeFolder) { if (isUserHomeFolder) {
// If the current folder is the user's home folder, label it as "Home" // If the current folder is the user's home folder, label it as "Home"
homeItem.textContent = getTranslatedText('breadcrumb.home', 'Home'); homeItem.textContent = getTranslatedText('breadcrumb.home', 'Home');
} else if (folderName && folderName.startsWith('Mi Carpeta')) { } else if (folderName && folderName.startsWith('My Folder')) {
// If viewing a root folder but not the user's home folder, use its full name // If viewing a root folder but not the user's home folder, use its full name
homeItem.textContent = folderName; homeItem.textContent = folderName;
} else { } else {