Add handling for undefined account names

Previously, in gr-account-label, an undefined name field resulted in a
completely empty tag. This is because, in general, the name field is
autopopulated by gerrit. However, there are some cases (like with
certain buildbots) where the name field was undefined. Now, in this
case, the email is still displayed.

Bug: Issue 4617
Change-Id: I91c54a8823b20b04dbed2a86b2b987ac34a0f0f9
This commit is contained in:
Kasper Nilsson
2016-09-26 13:01:33 -07:00
parent 75b98f77d9
commit e848b842f6

View File

@@ -30,8 +30,11 @@
},
_computeAccountTitle: function(account) {
if (!account || !account.name) { return; }
var result = util.escapeHTML(account.name);
if (!account || (!account.name && !account.email)) { return; }
var result = '';
if (account.name) {
result += util.escapeHTML(account.name);
}
if (account.email) {
result += ' <' + util.escapeHTML(account.email) + '>';
}