Browse code

[Calendar] BM-12926 Fix: Attendee autocomplete correctly recognize valid e-mail

Mehdi Rande authored on 09/03/2018 08:03:06
Showing 1 changed files
... ...
@@ -129,18 +129,18 @@ net.bluemind.calendar.vevent.ac.AttendeeMatcher.prototype.onMatch = function(tok
129 129
  *          matching.
130 130
  * @param {string=} opt_fullString The full string from the input box.
131 131
  */
132
-net.bluemind.calendar.vevent.ac.AttendeeMatcher.prototype.requestMatchingRows = function(token, maxMatches,
132
+net.bluemind.calendar.vevent.ac.AttendeeMatcher.prototype.requestMatchingRows = function(raw, maxMatches,
133 133
     matchHandler, opt_fullString) {
134 134
 
135
-  if (!this.shouldRequestMatches(token, maxMatches, opt_fullString)) {
135
+  if (!this.shouldRequestMatches(raw, maxMatches, opt_fullString)) {
136 136
     return;
137 137
   }
138 138
 
139
-  token = this.ctx_.helper('elasticsearch').escape(token);
139
+  token = this.ctx_.helper('elasticsearch').escape(raw);
140 140
   var q = '(_exists_:value.communications.emails.value OR value.kind:group) AND (value.identification.formatedName.value:'
141 141
       + token + ' OR value.communications.emails.value:' + token + ')';
142 142
 
143
-  var callback = goog.bind(this.onMatch, this, token, matchHandler);
143
+  var callback = goog.bind(this.onMatch, this, raw, matchHandler);
144 144
   this.ctx_
145 145
       .service('addressbooks')
146 146
       .search(token, 0, 10, 'Pertinance', q)
... ...
@@ -192,15 +192,15 @@ net.bluemind.calendar.vevent.ac.AttendeeMatcher.prototype.requestMatchingRows =
192 192
       }, null, this)
193 193
       .then(
194 194
           function(r) {
195
-            if (token
196
-                && token
195
+            if (raw
196
+                && raw
197 197
                     .match("^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@([A-Za-z0-9-]+\\.)+[A-Za-z]{2,}$")) {
198 198
               var ret = {
199 199
                 'cutype' : 'Individual',
200
-                'commonName' : token,
200
+                'commonName' : raw,
201 201
                 'dir' : null,
202 202
                 'uri' : null,
203
-                'mailto' : token,
203
+                'mailto' : raw,
204 204
                 'rsvp' : true,
205 205
                 'memberCount' : 0
206 206
               };