Inline accountOrAnon methods

Change-Id: Ie5be1a8c43520e80a4bb581fa7c4ea52b5ba426f
This commit is contained in:
Ben Rohlfs
2020-02-27 17:07:06 +01:00
parent ed25f28545
commit 901901a285
2 changed files with 3 additions and 10 deletions

View File

@@ -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}"`,
};
});
}

View File

@@ -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 + '>';