mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Fix incorrect normalization in typeahead result matching
Summary: Ref T4441. In D8250 I added code to drop results if they don't match the current typeahead state, but with the OnDemand source we were incorrectly comparing normalized values to denormalized values. Instead, pass and compare raw values. Auditors: btrahan, chad
This commit is contained in:
parent
40aa1d8576
commit
b1ecedddc7
2 changed files with 19 additions and 15 deletions
|
@ -14,7 +14,7 @@ return array(
|
|||
'differential.pkg.js' => '322ea941',
|
||||
'diffusion.pkg.css' => '3783278d',
|
||||
'diffusion.pkg.js' => '7b51e80a',
|
||||
'javelin.pkg.js' => 'b771965e',
|
||||
'javelin.pkg.js' => '70ecd3ac',
|
||||
'maniphest.pkg.css' => 'f1887d71',
|
||||
'maniphest.pkg.js' => '1e8f11af',
|
||||
'rsrc/css/aphront/aphront-bars.css' => '231ac33c',
|
||||
|
@ -211,7 +211,7 @@ return array(
|
|||
'rsrc/externals/javelin/lib/control/typeahead/Typeahead.js' => 'c54eeefb',
|
||||
'rsrc/externals/javelin/lib/control/typeahead/normalizer/TypeaheadNormalizer.js' => '5f850b5c',
|
||||
'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadCompositeSource.js' => '0136cec1',
|
||||
'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadOnDemandSource.js' => '7383383f',
|
||||
'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadOnDemandSource.js' => '89889fe7',
|
||||
'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadPreloadedSource.js' => 'e9b95df3',
|
||||
'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadSource.js' => '62e18640',
|
||||
'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadStaticSource.js' => 'c2b8bf64',
|
||||
|
@ -644,7 +644,7 @@ return array(
|
|||
'javelin-typeahead' => 'c54eeefb',
|
||||
'javelin-typeahead-composite-source' => '0136cec1',
|
||||
'javelin-typeahead-normalizer' => '5f850b5c',
|
||||
'javelin-typeahead-ondemand-source' => '7383383f',
|
||||
'javelin-typeahead-ondemand-source' => '89889fe7',
|
||||
'javelin-typeahead-preloaded-source' => 'e9b95df3',
|
||||
'javelin-typeahead-source' => '62e18640',
|
||||
'javelin-typeahead-static-source' => 'c2b8bf64',
|
||||
|
@ -1245,13 +1245,6 @@ return array(
|
|||
0 => 'javelin-behavior',
|
||||
1 => 'javelin-dom',
|
||||
),
|
||||
'7383383f' =>
|
||||
array(
|
||||
0 => 'javelin-install',
|
||||
1 => 'javelin-util',
|
||||
2 => 'javelin-request',
|
||||
3 => 'javelin-typeahead-source',
|
||||
),
|
||||
'75e50c72' =>
|
||||
array(
|
||||
0 => 'javelin-behavior',
|
||||
|
@ -1366,6 +1359,13 @@ return array(
|
|||
6 => 'javelin-history',
|
||||
7 => 'javelin-vector',
|
||||
),
|
||||
'89889fe7' =>
|
||||
array(
|
||||
0 => 'javelin-install',
|
||||
1 => 'javelin-util',
|
||||
2 => 'javelin-request',
|
||||
3 => 'javelin-typeahead-source',
|
||||
),
|
||||
'8a3ed18b' =>
|
||||
array(
|
||||
0 => 'javelin-magical-init',
|
||||
|
|
|
@ -46,7 +46,7 @@ JX.install('TypeaheadOnDemandSource', {
|
|||
var value = this.normalize(raw_value);
|
||||
|
||||
if (this.haveData[value]) {
|
||||
this.matchResults(value);
|
||||
this.matchResults(raw_value);
|
||||
} else {
|
||||
// If we have data for any prefix of the query, send those results
|
||||
// back immediately. This allows "alinc" -> "alinco" to show partial
|
||||
|
@ -56,7 +56,7 @@ JX.install('TypeaheadOnDemandSource', {
|
|||
for (var ii = value.length - 1; ii > 0; ii--) {
|
||||
var substr = value.substring(0, ii);
|
||||
if (this.haveData[substr]) {
|
||||
this.matchResults(value, false);
|
||||
this.matchResults(raw_value, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -75,23 +75,27 @@ JX.install('TypeaheadOnDemandSource', {
|
|||
}
|
||||
var r = new JX.Request(
|
||||
this.uri,
|
||||
JX.bind(this, this.ondata, this.lastChange, value));
|
||||
JX.bind(this, this.ondata, this.lastChange, raw_value));
|
||||
r.setMethod('GET');
|
||||
r.setData(JX.copy(this.getAuxiliaryData(), {q : value, raw: raw_value}));
|
||||
r.send();
|
||||
},
|
||||
|
||||
ondata : function(when, value, results) {
|
||||
ondata : function(when, raw_value, results) {
|
||||
if (results) {
|
||||
for (var ii = 0; ii < results.length; ii++) {
|
||||
this.addResult(results[ii]);
|
||||
}
|
||||
}
|
||||
|
||||
var value = this.normalize(raw_value);
|
||||
this.haveData[value] = true;
|
||||
|
||||
if (when != this.lastChange) {
|
||||
return;
|
||||
}
|
||||
this.matchResults(value);
|
||||
|
||||
this.matchResults(raw_value);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue