Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions i18n/en-US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,8 @@ be.uploadsFileSizeLimitExceededErrorMessage = File size exceeds the folder owner
be.uploadsFileSizeLimitExceededErrorMessageForUpgradeCta = This file exceeds your plan’s upload limit. Upgrade now to store larger files.
# Upgrade message shown when file size exceeds the limit
be.uploadsFileSizeLimitExceededUpgradeMessageForUpgradeCta = Upgrade
# Error message shown when the user lacks permission to upload to the destination folder
be.uploadsInsufficientPermissionsErrorMessage = You don't have permission to upload to this folder
# Error message shown when attempting to upload a file which name already exists
be.uploadsItemNameInUseErrorMessage = A file with this name already exists.
# Text shown when uploads are completed
Expand Down
1 change: 1 addition & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ export const ERROR_CODE_ITEM_NAME_TOO_LONG = 'item_name_too_long';
export const ERROR_CODE_ITEM_NAME_IN_USE = 'item_name_in_use';
export const ERROR_CODE_UPLOAD_FILE_LIMIT = 'upload_file_limit';
export const ERROR_CODE_UPLOAD_CHILD_FOLDER_FAILED = 'child_folder_failed_upload';
export const ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS = 'access_denied_insufficient_permissions';
export const ERROR_CODE_UPLOAD_STORAGE_LIMIT_EXCEEDED = 'storage_limit_exceeded';
export const ERROR_CODE_UPLOAD_FILE_SIZE_LIMIT_EXCEEDED = 'file_size_limit_exceeded';
export const ERROR_CODE_UPLOAD_PENDING_APP_FOLDER_SIZE_LIMIT = 'pending_app_folder_size_limit';
Expand Down
5 changes: 5 additions & 0 deletions src/elements/common/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,11 @@ const messages = defineMessages({
description: 'Error message shown when account storage limit has been reached',
defaultMessage: 'Account storage limit reached',
},
uploadsInsufficientPermissionsErrorMessage: {
id: 'be.uploadsInsufficientPermissionsErrorMessage',
description: 'Error message shown when the user lacks permission to upload to the destination folder',
defaultMessage: "You don't have permission to upload to this folder",
},
uploadsPendingFolderSizeLimitErrorMessage: {
id: 'be.uploadsPendingFolderSizeLimitErrorMessage',
description: 'Error message shown when pending app folder size exceeds the limit',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
ERROR_CODE_UPLOAD_FAILED_PACKAGE,
ERROR_CODE_UPLOAD_FILE_SIZE_LIMIT_EXCEEDED,
ERROR_CODE_UPLOAD_PENDING_APP_FOLDER_SIZE_LIMIT,
ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS,
ERROR_CODE_UPLOAD_STORAGE_LIMIT_EXCEEDED,
} from '../../../constants';

Expand Down Expand Up @@ -99,6 +100,12 @@ describe('elements/content-uploader/CellRenderer', () => {
expect(screen.getByText('Account storage limit reached')).toBeInTheDocument();
});

test('renders distinct error message for insufficient permissions (403)', () => {
const rowData = { status: STATUS_ERROR, error: { code: ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS } };
renderComponent(rowData);
expect(screen.getByText("You don't have permission to upload to this folder")).toBeInTheDocument();
});

test('renders error message for pending app folder size limit', () => {
const rowData = { status: STATUS_ERROR, error: { code: ERROR_CODE_UPLOAD_PENDING_APP_FOLDER_SIZE_LIMIT } };
renderComponent(rowData);
Expand Down
3 changes: 3 additions & 0 deletions src/elements/content-uploader/progressCellRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
ERROR_CODE_UPLOAD_FILE_SIZE_LIMIT_EXCEEDED,
ERROR_CODE_ITEM_NAME_IN_USE,
ERROR_CODE_ITEM_NAME_INVALID,
ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS,
ERROR_CODE_UPLOAD_PENDING_APP_FOLDER_SIZE_LIMIT,
ERROR_CODE_UPLOAD_STORAGE_LIMIT_EXCEEDED,
ERROR_CODE_UPLOAD_CHILD_FOLDER_FAILED,
Expand Down Expand Up @@ -48,6 +49,8 @@ const getErrorMessage = (
);
case ERROR_CODE_UPLOAD_STORAGE_LIMIT_EXCEEDED:
return <FormattedMessage {...messages.uploadsStorageLimitErrorMessage} />;
case ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS:
return <FormattedMessage {...messages.uploadsInsufficientPermissionsErrorMessage} />;
case ERROR_CODE_UPLOAD_PENDING_APP_FOLDER_SIZE_LIMIT:
return <FormattedMessage {...messages.uploadsPendingFolderSizeLimitErrorMessage} />;
case ERROR_CODE_UPLOAD_FAILED_PACKAGE:
Expand Down
Loading