mirror of
https://github.com/HeyPuter/puter.git
synced 2026-08-24 06:58:21 +00:00
Hide Trash from file explorer listing
Trash is accessible via the sidebar and should not appear as a row in the file explorer. Filters it out from directory listings and prevents socket events from re-adding it to the view.
This commit is contained in:
@@ -222,6 +222,10 @@ const TabFiles = {
|
||||
const parentDir = path.dirname(file.path);
|
||||
if ( _this.currentPath !== parentDir ) return;
|
||||
|
||||
// Trash is never listed in the explorer (sidebar has its own entry),
|
||||
// so a socket event must not re-add it either.
|
||||
if ( file.path === window.trash_path ) return;
|
||||
|
||||
// If item already exists in view, update in-place.
|
||||
const $existingRow = $(`.files-tab .files .item[data-uid='${file.uid}']`);
|
||||
if ( $existingRow.length > 0 ) {
|
||||
@@ -1965,10 +1969,12 @@ const TabFiles = {
|
||||
|
||||
this.updateSidebarSelection();
|
||||
|
||||
// Filter out hidden files/folders and AppData in home directory
|
||||
// Filter out hidden files/folders and AppData in home directory.
|
||||
// Trash is reachable from the sidebar; don't list it as a row too.
|
||||
directoryContents = directoryContents.filter(file => {
|
||||
if ( file.name.startsWith('.') ) return false;
|
||||
if ( file.name === 'AppData' && this.currentPath === window.home_path ) return false;
|
||||
if ( file.path === window.trash_path ) return false;
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user