Skip to content

Commit

Permalink
Merge pull request #16831 from ckeditor/ck/16830
Browse files Browse the repository at this point in the history
Internal (ckbox): Rename notification message when there is no permission to upload an image. Closes #16830.
  • Loading branch information
niegowski authored Aug 2, 2024
2 parents 7c84486 + 7e96e3a commit 319fb95
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/ckeditor5-ckbox/lang/contexts.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Open file manager": "A toolbar button tooltip for opening the file browser that allows inserting an image or a file to the editor.",
"Cannot determine a category for the uploaded file.": "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset.",
"Cannot access default workspace.": "A message is displayed when the user is not authorised to access the CKBox workspace configured as default one.",
"No permission for image editing. Try using the file manager or contact your administrator.": "The title of the notification displayed when there is no permission to edit assets.",
"You have no image editing permissions.": "The title of the notification displayed when there is no permission to edit assets.",
"Edit image": "Image toolbar button tooltip for opening a dialog to manipulate the image.",
"Processing the edited image.": "A message stating that image editing is in progress.",
"Server failed to process the image.": "A message is displayed when the server fails to process an image or doesn't respond.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class CKBoxImageEditUI extends Plugin {

view.bind( 'label' ).to( uploadImageCommand, 'isAccessAllowed', isAccessAllowed => isAccessAllowed ?
t( 'Edit image' ) :
t( 'No permission for image editing. Try using the file manager or contact your administrator.' )
t( 'You have no image editing permissions.' )
);
view.bind( 'isOn' ).to( command, 'value', command, 'isEnabled', ( value, isEnabled ) => value && isEnabled );
view.bind( 'isEnabled' ).to( command );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ describe( 'CKBoxImageEditUI', () => {
const uploadImageCommand = editor.commands.get( 'uploadImage' );
uploadImageCommand.set( 'isAccessAllowed', false );

expect( button.label ).to.equal( 'No permission for image editing. Try ' +
'using the file manager or contact your administrator.' );
expect( button.label ).to.equal( 'You have no image editing permissions.' );
} );

it( 'should have an icon', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/ckeditor5-image/lang/contexts.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"From computer": "The label for the upload image from computer menu bar button (inside 'Image' menu).",
"Replace image from computer": "The label for the replace image by upload from computer toolbar button.",
"Upload failed": "The title of the notification displayed when upload fails.",
"No permission to upload from computer. Try using the file manager or contact your administrator.": "The title of the notification displayed when there is no permission to upload assets.",
"You have no image upload permissions.": "The title of the notification displayed when there is no permission to upload assets.",
"Image toolbar": "The label used by assistive technologies describing an image toolbar attached to an image widget.",
"Resize image": "The label used for the dropdown in the image toolbar containing defined resize options.",
"Resize image to %0": "The label used for the standalone resize options buttons in the image toolbar.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default class ImageUploadEditing extends Plugin {
const t = editor.locale.t;

// eslint-disable-next-line max-len
notification.showWarning( t( 'No permission to upload from computer. Try using the file manager or contact your administrator.' ), {
notification.showWarning( t( 'You have no image upload permissions.' ), {
namespace: 'image'
} );
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ckeditor5-image/src/imageupload/imageuploadui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export default class ImageUploadUI extends Plugin {
'isAccessAllowed',
( isImageSelected, isAccessAllowed ) => {
if ( !isAccessAllowed ) {
return t( 'No permission to upload from computer. Try using the file manager or contact your administrator.' );
return t( 'You have no image upload permissions.' );
}

return isImageSelected ? t( 'Replace image from computer' ) : t( 'Upload image from computer' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,7 @@ describe( 'ImageUploadEditing', () => {

notification.on( 'show:warning', ( evt, data ) => {
tryExpect( done, () => {
expect( data.message ).to.equal( 'No permission to upload from computer. Try using the file manager ' +
'or contact your administrator.' );
expect( data.message ).to.equal( 'You have no image upload permissions.' );
evt.stop();
} );
}, { priority: 'high' } );
Expand Down
6 changes: 2 additions & 4 deletions packages/ckeditor5-image/tests/imageupload/imageuploadui.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,12 @@ describe( 'ImageUploadUI', () => {
expect( buttonView.label ).to.equal( 'Replace from computer' );

uploadImageCommand.isAccessAllowed = false;
expect( dropdownButton.label ).to.equal( 'No permission to upload from computer. ' +
'Try using the file manager or contact your administrator.' );
expect( dropdownButton.label ).to.equal( 'You have no image upload permissions.' );
expect( buttonView.label ).to.equal( 'Replace from computer' );

insertImageUI.isImageSelected = false;
uploadImageCommand.isAccessAllowed = false;
expect( dropdownButton.label ).to.equal( 'No permission to upload from computer. ' +
'Try using the file manager or contact your administrator.' );
expect( dropdownButton.label ).to.equal( 'You have no image upload permissions.' );
expect( buttonView.label ).to.equal( 'Upload from computer' );
} );

Expand Down

0 comments on commit 319fb95

Please sign in to comment.