commit 7b6816f253239d55428d46e538cc568b11754c1d Author: Ben Rohlfs Date: Fri Oct 2 13:20:26 2020 +0200 Do not add the owner to an otherwise empty attention set We want to excercise even more caution when adding users to the attention set: When the owner replies then also remove them or let the attention set stay empty. It is likely much more annoying, if the owner is added to attention set without wanting to than having to explicitly (re-)add themself. Change-Id: Ie4ff1b76af7954999495d35b84a482a16bc5d240 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 6ce0ceb..0732c0f 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 @@ -986,7 +986,7 @@ export class GrReplyDialog extends KeyboardShortcutMixin( // Add the owner, if someone else replies. Also add the owner, if the // attention set would otherwise be empty. if (change.owner) { - if (!this._isOwner(currentUser, change) || newAttention.size === 0) { + if (!this._isOwner(currentUser, change)) { // A change owner must have an _account_id. newAttention.add(change.owner._account_id!); } diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.js b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.js index 246ec88..301715c 100644 --- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.js +++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.js @@ -242,9 +242,11 @@ suite('gr-reply-dialog tests', () => { checkComputeAttention('NEW', 1, [22], 999, [22], [], [22, 999]); checkComputeAttention('NEW', 1, [22], 999, [], [22], [22, 999]); checkComputeAttention('NEW', 1, [22, 33], 999, [33], [22], [22, 33, 999]); - checkComputeAttention('NEW', 1, [], 1, [], [], [1]); - checkComputeAttention('NEW', 1, [], 1, [1], [], [1]); - checkComputeAttention('NEW', 1, [22], 1, [], [], [1]); + // If the owner replies, then do not add them. + checkComputeAttention('NEW', 1, [], 1, [], [], []); + checkComputeAttention('NEW', 1, [], 1, [1], [], []); + checkComputeAttention('NEW', 1, [22], 1, [], [], []); + checkComputeAttention('NEW', 1, [22], 1, [], [22], [22]); checkComputeAttention('NEW', 1, [22, 33], 1, [33], [22], [22, 33]); checkComputeAttention('NEW', 1, [22, 33], 1, [], [22], [22]);