Update GrReplyDialog to use UserId

Release-Notes: skip
Google-bug-id: b/236921879
Change-Id: I45c096f1aaf2b62b0be0f2b6693fa8866a6446ba
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 6659602..b7271db 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
@@ -49,7 +49,6 @@
   ChangeInfo,
   CommentInput,
   GroupInfo,
-  EmailAddress,
   isAccount,
   isDetailedLabelInfo,
   isReviewerAccountSuggestion,
@@ -62,6 +61,7 @@
   ServerInfo,
   SuggestedReviewerGroupInfo,
   Suggestion,
+  UserId,
 } from '../../../types/common';
 import {GrButton} from '../../shared/gr-button/gr-button';
 import {GrLabelScores} from '../gr-label-scores/gr-label-scores';
@@ -354,10 +354,10 @@
   attentionExpanded = false;
 
   @state()
-  currentAttentionSet: Set<AccountId | EmailAddress> = new Set();
+  currentAttentionSet: Set<UserId> = new Set();
 
   @state()
-  newAttentionSet: Set<AccountId | EmailAddress> = new Set();
+  newAttentionSet: Set<UserId> = new Set();
 
   @state()
   sendDisabled?: boolean;
@@ -1589,8 +1589,7 @@
   handleAttentionClick(e: Event) {
     const targetAccount = (e.target as GrAccountChip)?.account;
     if (!targetAccount) return;
-    // TODO: Remove cast and add support for GroupId as id type
-    const id = getUserId(targetAccount) as AccountId | EmailAddress;
+    const id = getUserId(targetAccount);
     if (!id || !this.account || !this.change?.owner) return;
 
     const self = id === getUserId(this.account) ? '_SELF' : '';
@@ -1696,7 +1695,7 @@
     // Finally make sure that everyone in the attention set is still active as
     // owner, reviewer or cc.
     const allAccountIds = this.allAccounts()
-      .map(a => a._account_id || a.email)
+      .map(a => getUserId(a))
       .filter(id => !!id);
     this.newAttentionSet = new Set([
       ...[...newAttention].filter(id => allAccountIds.includes(id)),
@@ -1775,9 +1774,9 @@
       .filter(account => !!account) as AccountInfo[];
   }
 
-  findAccountById(accountId: AccountId | EmailAddress) {
+  findAccountById(userId: UserId) {
     return this.allAccounts().find(
-      r => r._account_id === accountId || r.email === accountId
+      r => r._account_id === userId || r.email === userId
     );
   }