From: Mike Taylor Date: Fri, 6 Jun 2014 16:06:22 +0000 (+0100) Subject: The autosearch method now detects when multiple autosearches are X-Git-Tag: 1.0.0~540 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=c0f0e5c3d34eccc164a6e971843c767a189cf1f3;hp=-c;p=mkws-moved-to-github.git The autosearch method now detects when multiple autosearches are requested on the same team. It reports and ignores benign duplicates, and at present does the same with conflicts. It could instead throw an error in that case. --- c0f0e5c3d34eccc164a6e971843c767a189cf1f3 diff --git a/src/mkws-widget.js b/src/mkws-widget.js index 33c977f..0c41a31 100644 --- a/src/mkws-widget.js +++ b/src/mkws-widget.js @@ -95,8 +95,17 @@ function widget($, team, type, node) { } } - // Stash this for subsequent inspection - this.team.config().query = query; + var old = this.team.config().query; + if (!old) { + // Stash this for subsequent inspection + this.team.config().query = query; + } else if (old === query) { + this.log("duplicate autosearch: '" + query + "': ignoring"); + return; + } else { + this.log("conflicting autosearch: '" + query + "' vs '" + old + "': ignoring"); + return; + } this.team.queue("ready").subscribe(function() { // Postpone testing for the configuration items: these are not