Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Align code to the new ckeditor5-cloudservices package #8

Merged
merged 13 commits into from
Oct 31, 2017
Merged

Conversation

ma2ciek
Copy link
Contributor

@ma2ciek ma2ciek commented Oct 27, 2017

Other: Aligned code to the new ckeditor5-cloudservices package. Closes ckeditor/ckeditor5#2558.


xhr.send( null );
} );
return `${ CLOUD_SERVICES_TOKEN_URL }?user.id=${ userId }`;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newest CS should support anonymous users. It means that you don't need to set user.id, and the whole file is not needed.

Copy link
Contributor Author

@ma2ciek ma2ciek Oct 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do something like this in every sample and snippet?

cloudServices: {
	tokenUrl: 'https://j2sns7jmy0.execute-api.eu-central-1.amazonaws.com/prod/token'
},

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"every sample"

Is there more than one? :P

I would go with:

const CLOUD_SERVICES_TOKEN_URL = 'https://j2sns7jmy0.execute-api.eu-central-1.amazonaws.com/prod/token';

//...

cloudServices: {
	tokenUrl: CLOUD_SERVICES_TOKEN_URL
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ach, then I would: export CLOUD_SERVICES_TOKEN_URL.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll wait with changes for the correct token URI.

@@ -26,7 +27,7 @@ export default class CloudServicesUploadAdapter extends Plugin {
* @inheritDoc
*/
static get requires() {
return [ FileRepository ];
return [ FileRepository, CloudServicesUploadAdapter._CloudServices ];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use to mock plugins. I would mock CloudServices class in CloudServices plugin instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

package.json Outdated
@@ -7,7 +7,8 @@
"ckeditor5-feature"
],
"dependencies": {
"@ckeditor/ckeditor-cloudservices-core": "^0.1.0",
"@ckeditor/ckeditor-cloudservices-core": "^0.1.1",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be changed to "^0.2.0".

package.json Outdated
@@ -7,7 +7,8 @@
"ckeditor5-feature"
],
"dependencies": {
"@ckeditor/ckeditor-cloudservices-core": "^0.1.0",
"@ckeditor/ckeditor-cloudservices-core": "^0.2.0",
"@ckeditor/ckeditor5-cloudservices": "^1.0.0-alpha.1",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that until we will release it on npm, it should be as:

"@ckeditor/ckeditor5-cloudeservices": "ckeditor/ckeditor5-cloudservices"

Otherwise there will be errors.

uploadUrl: 'http://upload.mock.url/'
}
} )
.then( editor => {
expect( UploadGatewayMock.lastToken ).to.equal( 'abc' );
expect( UploadGatewayMock.lastToken.value ).to.equal( 'token' );
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not check internals of the token class here. I would remove this assertion since this test is not about it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adjust easy image to CS token refreshing mechanism
2 participants