refactor: remove hidden files indexing configuration and convert to UI-only display preference, eliminating includeHidden and hiddenWhitelist from vault config and indexing logic while adding hideHiddenFiles client-side filtering
This commit is contained in:
@@ -1,42 +1,2 @@
|
||||
"""Utility functions shared across backend modules."""
|
||||
from typing import Dict, Any, Tuple
|
||||
|
||||
|
||||
def should_include_path(rel_parts: Tuple[str, ...], vault_config: Dict[str, Any]) -> bool:
|
||||
"""Check if a path should be included based on hidden files configuration.
|
||||
|
||||
Simplified logic:
|
||||
- If includeHidden=True: include ALL hidden files/folders recursively
|
||||
- If includeHidden=False: check whitelist
|
||||
- If a whitelisted folder is in the path, include ALL sub-hidden files/folders
|
||||
- Otherwise, exclude the path
|
||||
|
||||
Args:
|
||||
rel_parts: Tuple of path parts relative to vault root
|
||||
vault_config: Vault configuration dict with includeHidden and hiddenWhitelist
|
||||
|
||||
Returns:
|
||||
True if the path should be included, False otherwise
|
||||
"""
|
||||
include_hidden = vault_config.get("includeHidden", False)
|
||||
hidden_whitelist = vault_config.get("hiddenWhitelist", [])
|
||||
|
||||
# Check if any part of the path starts with a dot (hidden)
|
||||
hidden_parts = [part for part in rel_parts if part.startswith(".")]
|
||||
|
||||
if not hidden_parts:
|
||||
# No hidden parts, always include
|
||||
return True
|
||||
|
||||
if include_hidden:
|
||||
# Include all hidden files/folders recursively
|
||||
return True
|
||||
|
||||
# Check if the FIRST hidden part is in the whitelist
|
||||
# If yes, include all sub-hidden files/folders automatically
|
||||
first_hidden = hidden_parts[0]
|
||||
if first_hidden in hidden_whitelist:
|
||||
return True
|
||||
|
||||
# First hidden part not in whitelist, exclude
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user