Revert "Revert "Filter account entry suggestions""

This reverts commit 7f1e827712.

Reason for revert: Fixed issue 8957. `cansee` operator is now only used
in the getSuggestedAccounts request.

Bug: Issue 8722
Change-Id: If204e28afd482dce500dd2e3bc866ef6e3c52984
This commit is contained in:
Kasper Nilsson 2018-05-08 19:43:12 +00:00 committed by David Pursehouse
parent 8e5606c49d
commit 04784ef40c
2 changed files with 6 additions and 2 deletions

View File

@ -119,10 +119,11 @@
},
_getReviewerSuggestions(input) {
if (!this.change) { return Promise.resolve([]); }
if (!this.change || !this.change._number) { return Promise.resolve([]); }
const api = this.$.restAPI;
const xhr = this.allowAnyUser ?
api.getSuggestedAccounts(input) :
api.getSuggestedAccounts(`cansee:${this.change._number} ${input}`) :
api.getChangeSuggestedReviewers(this.change._number, input);
return xhr.then(reviewers => {

View File

@ -79,6 +79,7 @@ limitations under the License.
element = fixture('basic');
element.change = {
_number: 42,
owner,
reviewers: {
CC: [existingReviewer1],
@ -178,12 +179,14 @@ limitations under the License.
element._getReviewerSuggestions('').then(() => {
assert.isTrue(suggestReviewerStub.calledOnce);
assert.isTrue(suggestReviewerStub.calledWith(42, ''));
assert.isFalse(suggestAccountStub.called);
element.allowAnyUser = true;
element._getReviewerSuggestions('').then(() => {
assert.isTrue(suggestReviewerStub.calledOnce);
assert.isTrue(suggestAccountStub.calledOnce);
assert.isTrue(suggestAccountStub.calledWith('cansee:42 '));
done();
});
});