-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: File Upload description bypassing message maximum character limi…
…t setting (#33218)
- Loading branch information
1 parent
b56d4c5
commit 6c83bf0
Showing
7 changed files
with
154 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@rocket.chat/meteor": patch | ||
"@rocket.chat/i18n": patch | ||
--- | ||
|
||
Fixes message character limit not being applied to file upload descriptions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
apps/meteor/client/views/room/modals/FileUploadModal/FileUploadModal.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { mockAppRoot } from '@rocket.chat/mock-providers'; | ||
import { render, screen } from '@testing-library/react'; | ||
import userEvent from '@testing-library/user-event'; | ||
import React from 'react'; | ||
|
||
import FileUploadModal from './FileUploadModal'; | ||
|
||
const defaultProps = { | ||
onClose: () => undefined, | ||
file: new File([], 'testing.png'), | ||
fileName: 'Testing', | ||
fileDescription: '', | ||
onSubmit: () => undefined, | ||
invalidContentType: false, | ||
showDescription: true, | ||
}; | ||
|
||
it('should show Undo request button when roomOpen is true and transcriptRequest exist', async () => { | ||
render(<FileUploadModal {...defaultProps} />, { | ||
legacyRoot: true, | ||
wrapper: mockAppRoot() | ||
.withTranslations('en', 'core', { | ||
Cannot_upload_file_character_limit: 'Cannot upload file, description is over the {{count}} character limit', | ||
Send: 'Send', | ||
Upload_file_description: 'File description', | ||
}) | ||
.withSetting('Message_MaxAllowedSize', 10) | ||
.build(), | ||
}); | ||
|
||
const input = await screen.findByRole('textbox', { name: 'File description' }); | ||
expect(input).toBeInTheDocument(); | ||
await userEvent.type(input, '12345678910'); | ||
|
||
expect(screen.getByText('Cannot upload file, description is over the 10 character limit')).toBeInTheDocument(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters