Skip to content

Commit

Permalink
[Cases ]Add getAttachmentRemovalObject to file type. (#156031)
Browse files Browse the repository at this point in the history
## Summary

When deleting a file user action the message displayed should be "<user>
removed file".

before
<img width="1059" alt="Screenshot 2023-04-27 at 17 08 14"
src="https://user-images.githubusercontent.com/1533137/234906123-48452699-a1ee-4452-b2ed-2ec3d4422ac3.png">


after
<img width="1063" alt="Screenshot 2023-04-27 at 17 07 56"
src="https://user-images.githubusercontent.com/1533137/234906310-4cc9c752-da76-441e-b3de-3d6194e821cb.png">
  • Loading branch information
adcoelho committed Apr 27, 2023
1 parent c6b6e28 commit 3480acd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe('getFileType', () => {
icon: 'document',
displayName: 'File Attachment Type',
getAttachmentViewObject: expect.any(Function),
getAttachmentRemovalObject: expect.any(Function),
});
});

Expand Down Expand Up @@ -184,4 +185,11 @@ describe('getFileType', () => {
);
});
});

describe('getFileAttachmentRemovalObject', () => {
it('event renders the right message', async () => {
// @ts-ignore
expect(fileType.getAttachmentRemovalObject().event).toBe('removed file');
});
});
});
1 change: 1 addition & 0 deletions x-pack/plugins/cases/public/components/files/file_type.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,5 @@ export const getFileType = (): ExternalReferenceAttachmentType => ({
icon: 'document',
displayName: 'File Attachment Type',
getAttachmentViewObject: getFileAttachmentViewObject,
getAttachmentRemovalObject: () => ({ event: i18n.REMOVED_FILE }),
});
4 changes: 4 additions & 0 deletions x-pack/plugins/cases/public/components/files/translations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,7 @@ export const DELETE = i18n.translate('xpack.cases.caseView.files.delete', {
export const DELETE_FILE_TITLE = i18n.translate('xpack.cases.caseView.files.deleteThisFile', {
defaultMessage: 'Delete this file?',
});

export const REMOVED_FILE = i18n.translate('xpack.cases.caseView.files.removedFile', {
defaultMessage: 'removed file',
});

0 comments on commit 3480acd

Please sign in to comment.