commit 25937b12aa3475c9e914d18fbfa5c0614777ac94 Author: Ben Rohlfs Date: Tue Oct 6 15:12:53 2020 +0200 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..eeefe45 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 @@ export class GrReplyDialog extends KeyboardShortcutMixin( @property({type: Array}) _ccs: (AccountInfo | GroupInfo)[] = []; + @property({type: Number}) + _attentionCcsCount = 0; + @property({type: Object, observer: '_reviewerPendingConfirmationUpdated'}) _ccPendingConfirmation: GroupObjectInput | null = null; @@ -948,7 +951,7 @@ export class GrReplyDialog extends KeyboardShortcutMixin( AccountInfoInput[], AccountInfoInput[] >, - _?: PolymerDeepPropertyChange, + ccs?: PolymerDeepPropertyChange, change?: ChangeInfo, draftCommentThreads?: CommentThread[], includeComments?: boolean @@ -957,6 +960,7 @@ export class GrReplyDialog extends KeyboardShortcutMixin( currentUser === undefined || currentUser._account_id === undefined || reviewers === undefined || + ccs === undefined || change === undefined || draftCommentThreads === undefined || includeComments === undefined @@ -966,6 +970,7 @@ export class GrReplyDialog extends KeyboardShortcutMixin( // 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 @@ export class GrReplyDialog extends KeyboardShortcutMixin( 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 @@ export const htmlTemplate = html` -