Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent fetching grid.json tiles in embeds with no interactive layers. #1979

Merged
merged 6 commits into from
Dec 19, 2017

Conversation

IagoLast
Copy link
Contributor

@IagoLast IagoLast commented Dec 18, 2017

#1976

  • Check if a layer is interactive or the map has the interactivity forced
  • Update cartodb-layer-group tests
    • Add leaflet tests
    • Add google tests

return false;
}
// Builder needs interactivity when the layer has no popup/infowindows to allow feature edition.
return layerModel.isInteractive() || this._mapModel.isFeatureInteractivityEnabled();
Copy link
Contributor

Choose a reason for hiding this comment

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

The second condition has little to do with the layer as the name of this method suggests so I would extract it from this method. It might also make sense to include the isVisible part inside of isInteractive? Perhaps not...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, the name is not the best... maybe _shouldEnableInteraction(layer) ?

- Check if a layer is interactive or the map has the interactivity forced
- Update cartodb-layer-group tests
  - Add leaflet tests
@@ -57,6 +66,7 @@ CartoDBLayerGroupViewBase.prototype = {
.on('off', function (o) {
if (self._interactionDisabled) return;
o = o || {};
// TODO: zera has an .on('error', () => { }) callback that should be used here
Copy link
Contributor

Choose a reason for hiding this comment

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

... that should be used here -> Why don't we use it then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the current issue is generating multiple errors in the track.js and we want to fix it asap IMO we should address the zera thing in a different issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

});
});

xdescribe("when there aren't tile URLS", function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

xdescribe

});

it('should trigger a "featureError" event when interactivity triggers a featureOut event', function (done) {
pending('Not implemented yet');
Copy link
Contributor

Choose a reason for hiding this comment

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

pending


xdescribe("when there aren't tile URLS", function () {
it('should fetch empty tiles', function () {
pending('how to compare the empty gif against the tile url?');
Copy link
Contributor

Choose a reason for hiding this comment

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

pending


it('should enable interaction when there are interactive layers ', function () {
mapModelMock.isFeatureInteractivityEnabled.and.returnValue(false);
spyOn(cartoDbLayer0, 'isInteractive').and.returnValue(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we can move this spy to the beforeEach so that we don't have to repeat it in other it blocks.

@@ -1,389 +0,0 @@
var _ = require('underscore');
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we removing this and duplicating the tests instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

This was/is kind of convenient IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Jasmine logs/workflow are easier to read this way (imo)

Copy link
Contributor

@alonsogarciapablo alonsogarciapablo left a comment

Choose a reason for hiding this comment

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

I left some comments about error handling and tests, but since this is important, we can tackle those in a follow up PR. All yours @IagoLast.

@IagoLast IagoLast merged commit 9a3877f into v4 Dec 19, 2017
@IagoLast IagoLast deleted the 1976-prevent-gridjson branch December 19, 2017 14:37
@Jesus89 Jesus89 restored the 1976-prevent-gridjson branch December 19, 2017 15:16
@IagoLast IagoLast deleted the 1976-prevent-gridjson branch December 19, 2017 16:01
@Jesus89 Jesus89 restored the 1976-prevent-gridjson branch December 19, 2017 16:40
@Jesus89 Jesus89 deleted the 1976-prevent-gridjson branch December 19, 2017 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants