hotspots: Fix real-time sync for dismissing hotspots.

This closes all the hotspots which aren't included in the event.hotspots.
This means we treat all the hotspots in event.hotspots as the hotspot
which need to be shown.

Fixes: #8690.
This commit is contained in:
Shubham Dhama
2018-03-18 00:07:40 +05:30
committed by Tim Abbott
parent 120ebc8f13
commit b34b8cdb97

View File

@@ -216,7 +216,15 @@ exports.close_hotspot_icon = function (elem) {
}); });
}; };
function close_read_hotspots(new_hotspots) {
var unwanted_hotspots = _.difference(_.keys(HOTSPOT_LOCATIONS), _.pluck(new_hotspots, 'name'));
_.each(unwanted_hotspots, function (hotspot_name) {
exports.close_hotspot_icon($('#hotspot_' + hotspot_name + '_icon'));
});
}
exports.load_new = function (new_hotspots) { exports.load_new = function (new_hotspots) {
close_read_hotspots(new_hotspots);
new_hotspots.forEach(function (hotspot) { new_hotspots.forEach(function (hotspot) {
hotspot.location = HOTSPOT_LOCATIONS[hotspot.name]; hotspot.location = HOTSPOT_LOCATIONS[hotspot.name];
}); });