From b97225c5e48966d196f4ab4c6c18bc558525c963 Mon Sep 17 00:00:00 2001 From: Tao Zhou Date: Mon, 21 Oct 2019 13:41:13 +0200 Subject: [PATCH] Fix keyLocation computation on ranged comments When comment is for a large range of codes, the begin and end of the range should not be collapsed into context. Bug: Issue 11726 Change-Id: I86020024a0261d72f2365651ed076e07ff59e358 --- polygerrit-ui/app/elements/diff/gr-diff/gr-diff.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.js b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.js index 540d6e6d2b..edb676effd 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.js +++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.js @@ -400,7 +400,13 @@ const commentSide = threadEl.getAttribute('comment-side'); const lineNum = Number(threadEl.getAttribute('line-num')) || GrDiffLine.FILE; + const commentRange = threadEl.range || {}; keyLocations[commentSide][lineNum] = true; + // Add start_line as well if exists, + // the being and end of the range should not be collapsed. + if (commentRange.start_line) { + keyLocations[commentSide][commentRange.start_line] = true; + } } return keyLocations; },