From bf1e9273f0b93a6ade520deb5a7d2d5cf4a776f0 Mon Sep 17 00:00:00 2001 From: Dhruv Srivastava Date: Sat, 1 Feb 2020 13:11:10 +0100 Subject: [PATCH] Remove delete icon for robot comments * Backend currently does not support deletion of robot comments. Change-Id: I734d62d60bafa389ee5023c7c2313e9fe0e3f1ed --- .../app/elements/shared/gr-comment/gr-comment.html | 1 + .../app/elements/shared/gr-comment/gr-comment_test.html | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.html b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.html index afd0e594b4..54cd529ce7 100644 --- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.html +++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.html @@ -264,6 +264,7 @@ limitations under the License. id="deleteBtn" link class$="action delete [[_computeDeleteButtonClass(_isAdmin, draft)]]" + hidden$="[[isRobotComment]]" on-click="_handleCommentDelete"> diff --git a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.html b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.html index 065801b318..e3391a0a19 100644 --- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.html +++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.html @@ -440,6 +440,9 @@ limitations under the License. assert.isFalse(element.$$('.humanActions').hasAttribute('hidden')); assert.isTrue(element.$$('.robotActions').hasAttribute('hidden')); + // Delete button is not hidden by default + assert.isFalse(element.shadowRoot.querySelector('#deleteBtn').hidden); + element.isRobotComment = true; element.draft = true; assert.isTrue(element.$$('.humanActions').hasAttribute('hidden')); @@ -463,6 +466,9 @@ limitations under the License. flushAsynchronousOperations(); assert.notEqual(getComputedStyle(element.$$('.robotRun.link')).display, 'none'); + + // Delete button is hidden for robot comments + assert.isTrue(element.shadowRoot.querySelector('#deleteBtn').hidden); }); test('collapsible drafts', () => {