Replace email with getUserId
Change 344637 updated mentioned users to be detailed accounts.
Google-bug-id: b/236921879
Release-Notes: skip
Change-Id: I0a009d5f370b281a129b664c0728894a839aa7e7
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 3ddcae4..81a29e3 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
@@ -1779,12 +1779,7 @@
}
computeHasNewAttention(account?: AccountInfo) {
- return !!(
- account &&
- ((account._account_id &&
- this.newAttentionSet?.has(account._account_id)) ||
- (account.email && this.newAttentionSet?.has(account.email)))
- );
+ return !!(account && this.newAttentionSet?.has(getUserId(account)));
}
computeNewAttention() {
@@ -1813,7 +1808,7 @@
const newAttention = new Set(this.currentAttentionSet);
for (const user of this.mentionedUsersInUnresolvedDrafts) {
- newAttention.add(user.email!);
+ newAttention.add(getUserId(user));
}
if (this.change.status === ChangeStatus.NEW) {
@@ -1942,9 +1937,7 @@
}
findAccountById(userId: UserId) {
- return this.allAccounts().find(
- r => r._account_id === userId || r.email === userId
- );
+ return this.allAccounts().find(r => getUserId(r) === userId);
}
allAccounts() {
@@ -2148,7 +2141,7 @@
private alreadyExists(ccs: AccountInput[], user: AccountInfoInput) {
return ccs
.filter(cc => isAccount(cc))
- .some(cc => (cc as AccountInfoInput).email === user.email);
+ .some(cc => getUserId(cc) === getUserId(user));
}
private isAlreadyReviewerOrCC(user: AccountInfo) {