Skip to content

Commit

Permalink
fix(chat): hide clientdata folder (Issue #2704)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaBondar committed Dec 16, 2024
1 parent 3b8d44d commit 122f2b0
Showing 1 changed file with 33 additions and 24 deletions.
57 changes: 33 additions & 24 deletions apps/chat/src/utils/app/data/file-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
import { FolderType } from '@/src/types/folder';
import { HTTPMethod } from '@/src/types/http';

import { CLIENTDATA_PATH } from '@/src/constants/client-data';

import { ApiUtils } from '../../server/api';
import { constructPath } from '../file';
import { getFileRootId } from '../id';
Expand Down Expand Up @@ -121,30 +123,37 @@ export class FileService {
this.getListingUrl({ path: parentPath, resultQuery }),
).pipe(
map((folders: BackendFileFolder[]) => {
return folders.map((folder): FileFolderInterface => {
const relativePath = folder.parentPath
? ApiUtils.decodeApiUrl(folder.parentPath)
: undefined;

return {
id: constructPath(
ApiKeys.Files,
folder.bucket,
relativePath,
folder.name,
),
name: folder.name,
type: FolderType.File,
absolutePath: constructPath(
ApiKeys.Files,
folder.bucket,
relativePath,
),
relativePath: relativePath,
folderId: constructPath(getFileRootId(folder.bucket), relativePath),
serverSynced: true,
};
});
return folders
.filter(
(folder) => !!folder.parentPath || folder.name !== CLIENTDATA_PATH,
)
.map((folder): FileFolderInterface => {
const relativePath = folder.parentPath
? ApiUtils.decodeApiUrl(folder.parentPath)
: undefined;

return {
id: constructPath(
ApiKeys.Files,
folder.bucket,
relativePath,
folder.name,
),
name: folder.name,
type: FolderType.File,
absolutePath: constructPath(
ApiKeys.Files,
folder.bucket,
relativePath,
),
relativePath: relativePath,
folderId: constructPath(
getFileRootId(folder.bucket),
relativePath,
),
serverSynced: true,
};
});
}),
);
}
Expand Down

0 comments on commit 122f2b0

Please sign in to comment.