diff options
Diffstat (limited to 'polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label.ts')
-rw-r--r-- | polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label.ts | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label.ts b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label.ts index cf7ff22090..1db484cab2 100644 --- a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label.ts +++ b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label.ts @@ -10,7 +10,11 @@ import '../../plugins/gr-endpoint-decorator/gr-endpoint-decorator'; import '../../plugins/gr-endpoint-param/gr-endpoint-param'; import {getAppContext} from '../../../services/app-context'; import {getDisplayName} from '../../../utils/display-name-util'; -import {isSelf, isServiceUser} from '../../../utils/account-util'; +import { + isDetailedAccount, + isSelf, + isServiceUser, +} from '../../../utils/account-util'; import {ChangeInfo, AccountInfo, ServerInfo} from '../../../types/common'; import {assertIsDefined, hasOwnProperty} from '../../../utils/common-util'; import {fire} from '../../../utils/event-util'; @@ -191,8 +195,20 @@ export class GrAccountLabel extends LitElement { override async updated() { assertIsDefined(this.account, 'account'); + if (isDetailedAccount(this.account)) return; const account = await this.getAccountsModel().fillDetails(this.account); - if (account) this.account = account; + if (!isDetailedAccount(account)) return; + // AccountInfo returned by fillDetails has the email property set + // to the primary email of the account. This poses a problem in + // cases where a secondary email is used as the committer or author + // email. Therefore, only fill in the *missing* properties. + if ( + account && + account !== this.account && + account._account_id === this.account._account_id + ) { + this.account = {...account, ...this.account}; + } } override render() { |