TagSpaces is an offline, open source, document manager with tagging support
Renamed file not reflected in kanban column (#2132)
Stanimirb1f15758b41c
diff --git a/package.json b/package.jsonindex cd3b63d7b..10a729d95 100644--- a/package.json+++ b/package.json@@ -229,7 +229,7 @@"uuid": "^9.0.0"},"optionalDependencies": {- "@tagspacespro/tagspacespro": "5.0.57"+ "@tagspacespro/tagspacespro": "5.0.58"},"devDependencies": {"@electron/notarize": "^2.3.2",diff --git a/src/renderer/hooks/DirectoryContentContextProvider.tsx b/src/renderer/hooks/DirectoryContentContextProvider.tsxindex ee2c62b80..f0469d3cd 100644--- a/src/renderer/hooks/DirectoryContentContextProvider.tsx+++ b/src/renderer/hooks/DirectoryContentContextProvider.tsx@@ -471,14 +471,6 @@ export const DirectoryContentContextProvider = ({) === cleanTrailingDirSeparator(cleanFrontDirSeparator(dirPath))) {currentDirectoryEntries.current.push(entry);- // reflect add KanBan folders visibility todo move in IOActionContext- /*if (!entry.isFile) {- await toggleDirVisibility(- { name: entry.name, uuid: entry.uuid },- dirPath,- false,- );- }*/}}}diff --git a/src/renderer/hooks/IOActionsContextProvider.tsx b/src/renderer/hooks/IOActionsContextProvider.tsxindex f1b1b6637..044d947d2 100644--- a/src/renderer/hooks/IOActionsContextProvider.tsx+++ b/src/renderer/hooks/IOActionsContextProvider.tsx@@ -39,6 +39,7 @@ import {cleanTrailingDirSeparator,cleanFrontDirSeparator,generateFileName,+ extractParentDirectoryPath,} from '@tagspaces/tagspaces-common/paths';import { getUuid } from '@tagspaces/tagspaces-common/utils-io';import { actions as AppActions, AppDispatch } from '-/reducers/app';@@ -197,6 +198,7 @@ type IOActionsContextData = {dir: TS.OrderVisibilitySettings,parentDirPath?,) => void;+ reflectRenameVisibility: (oldDirPath: string, newDirPath: string) => void;getDirectoryOrder: (path: string,dirs: Array<TS.FileSystemEntry>,@@ -242,6 +244,7 @@ export const IOActionsContext = createContext<IOActionsContextData>({setThumbnailImageChange: undefined,setFolderBackgroundPromise: undefined,toggleDirVisibility: undefined,+ reflectRenameVisibility: undefined,getDirectoryOrder: undefined,getFilesOrder: undefined,pushFileOrder: undefined,@@ -307,6 +310,21 @@ export const IOActionsContextProvider = ({);}}+ } else if (action.action === 'update') {+ // reflect visibility change on renamed KanBan column+ if (!action.entry.isFile) {+ const dirPath = extractContainingDirectoryPath(+ action.entry.path,+ currentLocation?.getDirSeparator(),+ );+ if (+ cleanTrailingDirSeparator(+ cleanFrontDirSeparator(currentDirectoryPath),+ ) === cleanTrailingDirSeparator(cleanFrontDirSeparator(dirPath))+ ) {+ reflectRenameVisibility(action.oldEntryPath, action.entry.path);+ }+ }}}}@@ -1895,6 +1913,66 @@ export const IOActionsContextProvider = ({});}+ function reflectRenameVisibility(+ oldDirPath: string,+ newDirPath: string,+ ): void {+ const parentDirectory = extractContainingDirectoryPath(+ //extractParentDirectoryPath(+ oldDirPath,+ currentLocation?.getDirSeparator(),+ );+ const oldDir = extractDirectoryName(+ oldDirPath,+ currentLocation?.getDirSeparator(),+ );+ currentLocation+ .loadMetaDataPromise(parentDirectory)+ .then((fsEntryMeta) => {+ const customOrder: TS.CustomOrder = fsEntryMeta.customOrder+ ? fsEntryMeta.customOrder+ : {};++ //let dirs: TS.OrderVisibilitySettings[] = [dir];+ if (customOrder.folders && customOrder.folders.length > 0) {+ const index = customOrder.folders.findIndex(+ (col) => col.name === oldDir,+ );+ if (index !== -1) {+ const newDir = extractDirectoryName(+ newDirPath,+ currentLocation?.getDirSeparator(),+ );+ customOrder.folders[index] = {+ ...customOrder.folders[index],+ name: newDir,+ };+ const updatedFsEntryMeta = {+ ...fsEntryMeta,+ customOrder: { ...customOrder, folders: customOrder.folders },+ };++ saveCurrentLocationMetaData(parentDirectory, updatedFsEntryMeta)+ .then(() => {+ const action: TS.KanBanMetaActions = {+ action: 'directoryVisibilityChange',+ meta: updatedFsEntryMeta,+ };+ setReflectKanBanActions(action);+ })+ .catch((err) => {+ console.log(+ 'Error adding dirs for ' + parentDirectory + ' with ' + err,+ );+ });+ }+ }+ })+ .catch((ex) => {+ console.log(ex);+ });+ }+function getDirectoryOrder(path: string,dirs: Array<TS.FileSystemEntry>,@@ -2027,6 +2105,7 @@ export const IOActionsContextProvider = ({setThumbnailImageChange,setFolderBackgroundPromise,toggleDirVisibility,+ reflectRenameVisibility,getDirectoryOrder,getFilesOrder,pushFileOrder,diff --git a/src/renderer/services/search.ts b/src/renderer/services/search.tsindex 5dd84a247..92de54b2a 100644--- a/src/renderer/services/search.ts+++ b/src/renderer/services/search.ts@@ -156,6 +156,7 @@ const fuseOptions = {distance: 1000,tokenize: true,minMatchCharLength: 2,+ useExtendedSearch: true,keys: [{name: 'name',