Fix the ReviewInput format for attention set changes
Change-Id: I9671b1352162fc58e658fb6df30dd17dfb169d42
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.js b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.js
index f3c31aa..24bc142 100644
--- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.js
+++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.js
@@ -546,13 +546,19 @@
reviewInput.add_to_attention_set = [];
for (const user of this._newAttentionSet) {
if (!this._currentAttentionSet.has(user)) {
- reviewInput.add_to_attention_set.push(user);
+ reviewInput.add_to_attention_set.push({
+ user,
+ reason: 'manually added in reply dialog',
+ });
}
}
reviewInput.remove_from_attention_set = [];
for (const user of this._currentAttentionSet) {
if (!this._newAttentionSet.has(user)) {
- reviewInput.remove_from_attention_set.push(user);
+ reviewInput.remove_from_attention_set.push({
+ user,
+ reason: 'manually removed in reply dialog',
+ });
}
}
}
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 4c65298..456adb5 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
@@ -181,13 +181,17 @@
});
test('modified attention set', done => {
+ element._newAttentionSet = new Set([314]);
const buttonEl = element.shadowRoot.querySelector('.edit-attention-button');
MockInteractions.tap(buttonEl);
flushAsynchronousOperations();
stubSaveReview(review => {
assert.isTrue(review.ignore_default_attention_set_rules);
- assert.deepEqual(review.add_to_attention_set, []);
+ assert.deepEqual(review.add_to_attention_set, [{
+ user: 314,
+ reason: 'manually added in reply dialog',
+ }]);
assert.deepEqual(review.remove_from_attention_set, []);
done();
});