Modify search autocompletion to include only email
When a user's full name is included in the query, the search excludes commits where the full name does not appear in the author line. This may be a subset of the actual changes pertaining to the user. With this change, the search autocomplete results are instead generated to only include the email when it is known. Bug: Issue 7053 Change-Id: I4e20d6388f7b904c63786b9e87f9880a0f519b7e
This commit is contained in:
@@ -189,14 +189,9 @@
|
||||
MAX_AUTOCOMPLETE_RESULTS)
|
||||
.then(accounts => {
|
||||
if (!accounts) { return []; }
|
||||
return accounts.map(acct => {
|
||||
if (acct.email) {
|
||||
return predicate + ':"' + this._accountOrAnon(acct) +
|
||||
' <' + acct.email + '>"';
|
||||
} else {
|
||||
return predicate + ':"' + this._accountOrAnon(acct) + '"';
|
||||
}
|
||||
});
|
||||
return accounts.map(acct => acct.email ?
|
||||
`${predicate}:${acct.email}` :
|
||||
`${predicate}:"${this._accountOrAnon(acct)}"`);
|
||||
}).then(accounts => {
|
||||
// When the expression supplied is a beginning substring of 'self',
|
||||
// add it as an autocomplete option.
|
||||
|
@@ -105,7 +105,7 @@ limitations under the License.
|
||||
});
|
||||
|
||||
suite('_getSearchSuggestions', () => {
|
||||
test('Autocompletes accounts', done => {
|
||||
test('Autocompletes accounts', () => {
|
||||
sandbox.stub(element.$.restAPI, 'getSuggestedAccounts', () =>
|
||||
Promise.resolve([
|
||||
{
|
||||
@@ -114,9 +114,8 @@ limitations under the License.
|
||||
},
|
||||
])
|
||||
);
|
||||
element._getSearchSuggestions('owner:fr').then(s => {
|
||||
assert.equal(s[0].value, 'owner:"fred <fred@goog.co>"');
|
||||
done();
|
||||
return element._getSearchSuggestions('owner:fr').then(s => {
|
||||
assert.equal(s[0].value, 'owner:fred@goog.co');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -257,7 +256,7 @@ limitations under the License.
|
||||
])
|
||||
);
|
||||
element._getSearchSuggestions('owner:fr').then(s => {
|
||||
assert.equal(s[0].value, 'owner:"Anonymous <fred@goog.co>"');
|
||||
assert.equal(s[0].value, 'owner:fred@goog.co');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user