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)
|
MAX_AUTOCOMPLETE_RESULTS)
|
||||||
.then(accounts => {
|
.then(accounts => {
|
||||||
if (!accounts) { return []; }
|
if (!accounts) { return []; }
|
||||||
return accounts.map(acct => {
|
return accounts.map(acct => acct.email ?
|
||||||
if (acct.email) {
|
`${predicate}:${acct.email}` :
|
||||||
return predicate + ':"' + this._accountOrAnon(acct) +
|
`${predicate}:"${this._accountOrAnon(acct)}"`);
|
||||||
' <' + acct.email + '>"';
|
|
||||||
} else {
|
|
||||||
return predicate + ':"' + this._accountOrAnon(acct) + '"';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}).then(accounts => {
|
}).then(accounts => {
|
||||||
// When the expression supplied is a beginning substring of 'self',
|
// When the expression supplied is a beginning substring of 'self',
|
||||||
// add it as an autocomplete option.
|
// add it as an autocomplete option.
|
||||||
|
@@ -105,7 +105,7 @@ limitations under the License.
|
|||||||
});
|
});
|
||||||
|
|
||||||
suite('_getSearchSuggestions', () => {
|
suite('_getSearchSuggestions', () => {
|
||||||
test('Autocompletes accounts', done => {
|
test('Autocompletes accounts', () => {
|
||||||
sandbox.stub(element.$.restAPI, 'getSuggestedAccounts', () =>
|
sandbox.stub(element.$.restAPI, 'getSuggestedAccounts', () =>
|
||||||
Promise.resolve([
|
Promise.resolve([
|
||||||
{
|
{
|
||||||
@@ -114,9 +114,8 @@ limitations under the License.
|
|||||||
},
|
},
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
element._getSearchSuggestions('owner:fr').then(s => {
|
return element._getSearchSuggestions('owner:fr').then(s => {
|
||||||
assert.equal(s[0].value, 'owner:"fred <fred@goog.co>"');
|
assert.equal(s[0].value, 'owner:fred@goog.co');
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -257,7 +256,7 @@ limitations under the License.
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
element._getSearchSuggestions('owner:fr').then(s => {
|
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();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user