Add support for EmailAddress in handleAttentionClick
accountOrGroupKey method falls back to email when account_id is
not set.
Use the method for calculating id so that mention users do not
return early.
Release-Notes: skip
Google-bug-id: b/236921879
Change-Id: Iec6a6c188cf5f2d4d79ab716cbfda324ef7249b8
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
index e89b418..1514e20 100644
--- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
+++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
@@ -1588,14 +1588,15 @@
}
handleAttentionClick(e: Event) {
- const id = (e.target as GrAccountChip)?.account?._account_id;
- if (!id) return;
+ const targetAccount = (e.target as GrAccountChip)?.account;
+ if (!targetAccount) return;
+ // TODO: Remove cast and add support for GroupId as id type
+ const id = accountOrGroupKey(targetAccount) as AccountId | EmailAddress;
+ if (!id || !this.account || !this.change?.owner) return;
- const selfId = (this.account && this.account._account_id) || -1;
- const ownerId =
- (this.change && this.change.owner && this.change.owner._account_id) || -1;
- const self = id === selfId ? '_SELF' : '';
- const role = id === ownerId ? 'OWNER' : '_REVIEWER';
+ const self = id === accountOrGroupKey(this.account) ? '_SELF' : '';
+ const role =
+ id === accountOrGroupKey(this.change.owner) ? 'OWNER' : '_REVIEWER';
if (this.newAttentionSet.has(id)) {
this.newAttentionSet.delete(id);