diff --git a/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread.html b/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread.html index 6d034b0312..864294b392 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread.html +++ b/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread.html @@ -40,6 +40,7 @@ limitations under the License. project-config="[[projectConfig]]" on-reply="_handleCommentReply" on-comment-discard="_handleCommentDiscard" + on-ack="_handleCommentAck" on-done="_handleCommentDone"> diff --git a/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread.js b/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread.js index a24100f894..de1c19712c 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread.js @@ -162,6 +162,18 @@ this.push('comments', reply); }, + _handleCommentAck: function(e) { + var comment = e.detail.comment; + var reply = this._newReply(comment.id, comment.line, 'Ack'); + this.push('comments', reply); + + // Allow the reply to render in the dom-repeat. + this.async(function() { + var commentEl = this._commentElWithDraftID(reply.__draftID); + commentEl.save(); + }.bind(this), 1); + }, + _handleCommentDone: function(e) { var comment = e.detail.comment; var reply = this._newReply(comment.id, comment.line, 'Done'); diff --git a/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread_test.html b/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread_test.html index 7b85b62847..b694a754e4 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread_test.html +++ b/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread_test.html @@ -180,6 +180,23 @@ limitations under the License. {bubbles: false}); }); + test('ack', function(done) { + element.changeNum = '42'; + element.patchNum = '1'; + var commentEl = element.$$('gr-diff-comment'); + assert.ok(commentEl); + commentEl.addEventListener('ack', function() { + var drafts = element._orderedComments.filter(function(c) { + return c.__draft == true; + }); + assert.equal(drafts.length, 1); + assert.equal(drafts[0].message, 'Ack'); + assert.equal(drafts[0].in_reply_to, 'baf0414d_60047215'); + done(); + }); + commentEl.fire('ack', {comment: commentEl.comment}, {bubbles: false}); + }); + test('done', function(done) { element.changeNum = '42'; element.patchNum = '1'; diff --git a/polygerrit-ui/app/elements/diff/gr-diff-comment/gr-diff-comment.html b/polygerrit-ui/app/elements/diff/gr-diff-comment/gr-diff-comment.html index a7be3b7e15..a1c73dbbd9 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-comment/gr-diff-comment.html +++ b/polygerrit-ui/app/elements/diff/gr-diff-comment/gr-diff-comment.html @@ -93,11 +93,12 @@ limitations under the License. .danger .action { margin-right: 0; } - .container:not(.draft) .actions :not(.reply):not(.quote):not(.done) { + .container:not(.draft) .actions :not(.reply):not(.quote):not(.ack):not(.done) { display: none; } .draft .reply, .draft .quote, + .draft .ack, .draft .done { display: none; } @@ -111,6 +112,7 @@ limitations under the License. .editing .message, .editing .reply, .editing .quote, + .editing .ack, .editing .done, .editing .edit { display: none; @@ -191,6 +193,7 @@ limitations under the License.