From aaffbeb04936c0e5d96b8cffa8fe4c14e942a633 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Fri, 27 Feb 2009 06:06:29 -0500
Subject: [PATCH] Prevent concurrent autocomplete query results display (#1485743)

---
 CHANGELOG                           |    1 +
 program/steps/mail/autocomplete.inc |    2 +-
 program/js/app.js                   |    6 +++++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index ed66d6a..946b25e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -5,6 +5,7 @@
 ----------
 - Fix mime-type detection using a hard-coded map (#1485311)
 - Don't return empty string if charset conversion failed (#1485757)
+- Disable concurrent autocomplete query results display (#1485743)
 
 2009/02/26 (alec)
 ----------
diff --git a/program/js/app.js b/program/js/app.js
index f799057..7f1e724 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -2516,8 +2516,12 @@
     this.http_post('autocomplete', '_search='+q);
   };
 
-  this.ksearch_query_results = function(results)
+  this.ksearch_query_results = function(results, search)
   {
+    // ignore this outdated search response
+    if (search != this.ksearch_value)
+      return;
+      
     this.hide_message();
     this.env.contacts = results ? results : [];
 
diff --git a/program/steps/mail/autocomplete.inc b/program/steps/mail/autocomplete.inc
index c840e9c..26acc88 100644
--- a/program/steps/mail/autocomplete.inc
+++ b/program/steps/mail/autocomplete.inc
@@ -44,7 +44,7 @@
   sort($contacts);
 }
 
-$OUTPUT->command('ksearch_query_results', $contacts);
+$OUTPUT->command('ksearch_query_results', $contacts, $search);
 $OUTPUT->send();
 
 ?>
\ No newline at end of file

--
Gitblit v1.9.1