From e848b842f6f21a46f83996c44da01c70b0c4331b Mon Sep 17 00:00:00 2001 From: Kasper Nilsson Date: Mon, 26 Sep 2016 13:01:33 -0700 Subject: [PATCH] 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 --- .../elements/shared/gr-account-label/gr-account-label.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label.js b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label.js index 98871cb84b..40b7cf164d 100644 --- a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label.js +++ b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label.js @@ -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) + '>'; }