Fix showing the CC section in the attention modify section
The visibility of the CC section was just based on observing _ccs as a
whole, but that is just a constant array, which will never change. So
instead we introduce a new property `_attentionCcsCount`, which is
updated when the attention set is re-calculated, which observes
`_ccs.*`, not just `_ccs`.
Change-Id: I1c7ba406b41a44873757c339a8a8a9595cc4c5e4
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 a2a75d0..eeefe45b 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
@@ -273,6 +273,9 @@
@property({type: Array})
_ccs: (AccountInfo | GroupInfo)[] = [];
+ @property({type: Number})
+ _attentionCcsCount = 0;
+
@property({type: Object, observer: '_reviewerPendingConfirmationUpdated'})
_ccPendingConfirmation: GroupObjectInput | null = null;
@@ -948,7 +951,7 @@
AccountInfoInput[],
AccountInfoInput[]
>,
- _?: PolymerDeepPropertyChange<AccountInfoInput[], AccountInfoInput[]>,
+ ccs?: PolymerDeepPropertyChange<AccountInfoInput[], AccountInfoInput[]>,
change?: ChangeInfo,
draftCommentThreads?: CommentThread[],
includeComments?: boolean
@@ -957,6 +960,7 @@
currentUser === undefined ||
currentUser._account_id === undefined ||
reviewers === undefined ||
+ ccs === undefined ||
change === undefined ||
draftCommentThreads === undefined ||
includeComments === undefined
@@ -966,6 +970,7 @@
// The draft comments are only relevant for the attention set as long as the
// user actually plans to publish their drafts.
draftCommentThreads = includeComments ? draftCommentThreads : [];
+ this._attentionCcsCount = removeServiceUsers(ccs.base).length;
this._currentAttentionSet = new Set(
Object.keys(change.attention_set || {}).map(
id => parseInt(id) as AccountId
@@ -1124,10 +1129,6 @@
return removeServiceUsers(accounts);
}
- _computeShowAttentionCcs(ccs: AccountInfo[]) {
- return removeServiceUsers(ccs).length > 0;
- }
-
_computeUploader(change: ChangeInfo) {
if (
!change ||
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_html.ts b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_html.ts
index f076981..2413c97 100644
--- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_html.ts
+++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_html.ts
@@ -514,7 +514,7 @@
</template>
</div>
</div>
- <template is="dom-if" if="[[_computeShowAttentionCcs(_ccs)]]">
+ <template is="dom-if" if="[[_attentionCcsCount]]">
<div class="peopleList">
<div class="peopleListLabel">CC</div>
<div>