Inline accountOrAnon methods
Change-Id: Ie5be1a8c43520e80a4bb581fa7c4ea52b5ba426f
This commit is contained in:
@@ -72,10 +72,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
_accountOrAnon(name) {
|
||||
return this.getUserName(this._serverConfig, name, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch from the API the predicted projects.
|
||||
*
|
||||
@@ -154,11 +150,12 @@
|
||||
|
||||
_mapAccountsHelper(accounts, predicate) {
|
||||
return accounts.map(account => {
|
||||
const userName = this.getUserName(this._serverConfig, account, false);
|
||||
return {
|
||||
label: account.name || '',
|
||||
text: account.email ?
|
||||
`${predicate}:${account.email}` :
|
||||
`${predicate}:"${this._accountOrAnon(account)}"`,
|
||||
`${predicate}:"${userName}"`,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -44,17 +44,13 @@
|
||||
}
|
||||
|
||||
static getAccountDisplayName(config, account, enableEmail) {
|
||||
const reviewerName = this._accountOrAnon(config, account, enableEmail);
|
||||
const reviewerName = this.getUserName(config, account, !!enableEmail);
|
||||
const reviewerEmail = this._accountEmail(account.email);
|
||||
const reviewerStatus = account.status ? '(' + account.status + ')' : '';
|
||||
return [reviewerName, reviewerEmail, reviewerStatus]
|
||||
.filter(p => p.length > 0).join(' ');
|
||||
}
|
||||
|
||||
static _accountOrAnon(config, reviewer, enableEmail) {
|
||||
return this.getUserName(config, reviewer, !!enableEmail);
|
||||
}
|
||||
|
||||
static _accountEmail(email) {
|
||||
if (typeof email !== 'undefined') {
|
||||
return '<' + email + '>';
|
||||
|
||||
Reference in New Issue
Block a user