aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-08-06 08:37:55 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-08-06 09:39:42 +0100
commite46125e56cb922ebe8bbae527a53d06b28c173cc (patch)
treed1fd652bf6e66be4ba0b2b589d97635bee7b7394 /web
parentcc3e8bd6e93fd293934d8697e0daea58494ad28f (diff)
Do update layer visibility on extras received.
Asset layer visibility depends on fixmystreet.bodies, which is updated from ajax request by pin selection or category change, but the visibility change happens before the ajax request - so if visibility is not also checked when category_extras returns it can get out of sync.
Diffstat (limited to 'web')
-rw-r--r--web/cobrands/fixmystreet/assets.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js
index cd1e202e5..f53d26bbb 100644
--- a/web/cobrands/fixmystreet/assets.js
+++ b/web/cobrands/fixmystreet/assets.js
@@ -19,6 +19,9 @@ var fixmystreet = fixmystreet || {};
OpenLayers.Layer.VectorAsset = OpenLayers.Class(OpenLayers.Layer.Vector, {
initialize: function(name, options) {
OpenLayers.Layer.Vector.prototype.initialize.apply(this, arguments);
+ // Do in both locations so fixmystreet.bodies is up to date. Otherwise
+ // e.g. a layer can disappear the category change after it should.
+ $(fixmystreet).on('report_new:category_change:extras_received', this.update_layer_visibility.bind(this));
$(fixmystreet).on('report_new:category_change', this.update_layer_visibility.bind(this));
},