Skip to content

Commit ff7c5ee

Browse files
author
Yaroslav Kuznietsov
committed
Renamed isQuickAttachment to isFromDeviceAttachment
1 parent e639270 commit ff7c5ee

9 files changed

Lines changed: 25 additions & 25 deletions

File tree

apps/chat/src/components/Chat/ChatInput/ChatInputMessage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ export const ChatInputMessage = Inversify.register(
542542
id: file.id,
543543
relativePath: folderPath,
544544
name: file.name,
545-
isQuickAttachment: true,
545+
isFromDeviceAttachment: true,
546546
}),
547547
);
548548
});

apps/chat/src/components/Chat/ChatMessage/ChatMessageContent/AssistantMessage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ const AssistantMessageEditor = memo(function AssistantMessageEditor({
361361
(fileId: string) => {
362362
const fid = isFolderId(fileId) ? fileId.slice(0, -1) : fileId;
363363
const file = files.find((f) => f.id === fid);
364-
if (file?.isQuickAttachment) {
364+
if (file?.isFromDeviceAttachment) {
365365
dispatch(FilesActions.deleteFile({ fileId: fid }));
366366
} else {
367367
dispatch(FilesActions.uploadFileCancel({ id: fileId }));
@@ -397,7 +397,7 @@ const AssistantMessageEditor = memo(function AssistantMessageEditor({
397397
id: file.id,
398398
relativePath: folderPath,
399399
name: file.name,
400-
isQuickAttachment: true,
400+
isFromDeviceAttachment: true,
401401
}),
402402
);
403403
});

apps/chat/src/components/Chat/ChatMessage/ChatMessageContent/UserMessage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ export const UserMessage = memo(function UserMessage({
458458
(fileId: string) => {
459459
const fid = isFolderId(fileId) ? fileId.slice(0, -1) : fileId;
460460
const file = files.find((f) => f.id === fid);
461-
if (file?.isQuickAttachment) {
461+
if (file?.isFromDeviceAttachment) {
462462
dispatch(FilesActions.deleteFile({ fileId: fid }));
463463
} else {
464464
dispatch(FilesActions.uploadFileCancel({ id: fileId }));
@@ -494,7 +494,7 @@ export const UserMessage = memo(function UserMessage({
494494
id: file.id,
495495
relativePath: folderPath,
496496
name: file.name,
497-
isQuickAttachment: true,
497+
isFromDeviceAttachment: true,
498498
}),
499499
);
500500
});

apps/chat/src/hooks/useUploadFilesHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export const useUploadFilesHandler = (
142142
name: file.name,
143143

144144
showSuccessMessage: true,
145-
isQuickAttachment: true,
145+
isFromDeviceAttachment: true,
146146
}),
147147
);
148148
});

apps/chat/src/store/chat/chat.epics.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ const handleVoiceRecordingEpic: AppEpic = (action$, state$) =>
281281
id: fileId,
282282
relativePath,
283283
name: fileName,
284-
isQuickAttachment: true,
284+
isFromDeviceAttachment: true,
285285
}),
286286
),
287287
of(FilesActions.selectFiles({ ids: [fileId] })),
@@ -339,7 +339,7 @@ const handleUserMessageVoiceRecordingEpic: AppEpic = (action$, state$) =>
339339
id: fileId,
340340
relativePath,
341341
name: fileName,
342-
isQuickAttachment: true,
342+
isFromDeviceAttachment: true,
343343
}),
344344
),
345345
of(ChatActions.setUserMessageVoiceAttachmentId(fileId)),

apps/chat/src/store/files/__tests__/files.reducers.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ describe('files.reducers quick attachments', () => {
315315
type: 'text/plain',
316316
});
317317

318-
it('uploadFile sets isQuickAttachment when flag is passed', () => {
318+
it('uploadFile sets isFromDeviceAttachment when flag is passed', () => {
319319
const state = filesSlice.getInitialState();
320320

321321
const nextState = filesSlice.reducer(
@@ -325,16 +325,16 @@ describe('files.reducers quick attachments', () => {
325325
id: fileId,
326326
name: 'attachment.txt',
327327
relativePath: 'uploads/2025-01',
328-
isQuickAttachment: true,
328+
isFromDeviceAttachment: true,
329329
}),
330330
);
331331

332332
expect(nextState.files).toHaveLength(1);
333-
expect(nextState.files[0].isQuickAttachment).toBe(true);
333+
expect(nextState.files[0].isFromDeviceAttachment).toBe(true);
334334
expect(nextState.files[0].status).toBe(UploadStatus.LOADING);
335335
});
336336

337-
it('uploadFile does not set isQuickAttachment without flag', () => {
337+
it('uploadFile does not set isFromDeviceAttachment without flag', () => {
338338
const state = filesSlice.getInitialState();
339339

340340
const nextState = filesSlice.reducer(
@@ -347,17 +347,17 @@ describe('files.reducers quick attachments', () => {
347347
}),
348348
);
349349

350-
expect(nextState.files[0].isQuickAttachment).toBeUndefined();
350+
expect(nextState.files[0].isFromDeviceAttachment).toBeUndefined();
351351
});
352352

353-
it('uploadFileSuccess preserves isQuickAttachment', () => {
353+
it('uploadFileSuccess preserves isFromDeviceAttachment', () => {
354354
const state = {
355355
...filesSlice.getInitialState(),
356356
files: [
357357
makeFile({
358358
id: fileId,
359359
status: UploadStatus.LOADING,
360-
isQuickAttachment: true,
360+
isFromDeviceAttachment: true,
361361
}),
362362
],
363363
};
@@ -372,7 +372,7 @@ describe('files.reducers quick attachments', () => {
372372
}),
373373
);
374374

375-
expect(nextState.files[0].isQuickAttachment).toBe(true);
375+
expect(nextState.files[0].isFromDeviceAttachment).toBe(true);
376376
expect(nextState.files[0].serverSynced).toBe(true);
377377
});
378378

@@ -383,7 +383,7 @@ describe('files.reducers quick attachments', () => {
383383
files: [
384384
makeFile({
385385
id: fileId,
386-
isQuickAttachment: true,
386+
isFromDeviceAttachment: true,
387387
}),
388388
],
389389
};

apps/chat/src/store/files/files.epics.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ const reuploadFileEpic: AppEpic = (action$, state$) =>
212212
id: payload.fileId,
213213
relativePath: file.relativePath,
214214
name: file.name,
215-
...(file.isQuickAttachment && {
216-
isQuickAttachment: true,
215+
...(file.isFromDeviceAttachment && {
216+
isFromDeviceAttachment: true,
217217
}),
218218
}),
219219
);
@@ -566,7 +566,7 @@ const unselectFilesEpic: AppEpic = (action$, state$) =>
566566
switchMap(({ payload }) => {
567567
const files = FilesSelectors.selectFilesByIds(state$.value, payload.ids);
568568
const deleteActions = files
569-
.filter((file) => file.isQuickAttachment)
569+
.filter((file) => file.isFromDeviceAttachment)
570570
.map((file) => of(FilesActions.deleteFile({ fileId: file.id })));
571571

572572
return concat(...deleteActions);

apps/chat/src/store/files/files.reducers.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export const filesSlice = createSlice({
133133
bucket?: string;
134134

135135
showSuccessMessage?: boolean;
136-
isQuickAttachment?: boolean;
136+
isFromDeviceAttachment?: boolean;
137137
}>,
138138
) => {
139139
state.files = state.files.filter((file) => file.id !== payload.id);
@@ -149,8 +149,8 @@ export const filesSlice = createSlice({
149149
fileContent,
150150
contentLength: payload.fileContent.size,
151151
contentType: fileContent.type,
152-
...(payload.isQuickAttachment && {
153-
isQuickAttachment: true,
152+
...(payload.isFromDeviceAttachment && {
153+
isFromDeviceAttachment: true,
154154
}),
155155
});
156156
},
@@ -213,7 +213,7 @@ export const filesSlice = createSlice({
213213
contentLength:
214214
payload.apiResult.contentLength || file.contentLength,
215215
contentType: payload.apiResult.contentType || file.contentType,
216-
isQuickAttachment: file.isQuickAttachment,
216+
isFromDeviceAttachment: file.isFromDeviceAttachment,
217217
};
218218
}
219219
return file;

apps/chat/src/types/files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export type DialFile = Omit<
2525
percent?: number;
2626
fileContent?: File;
2727
isRootSharedItem?: boolean;
28-
isQuickAttachment?: boolean;
28+
isFromDeviceAttachment?: boolean;
2929
} & ShareEntity;
3030

3131
// For file folders folderId is relative path and id is relative path + '/' + name

0 commit comments

Comments
 (0)