Commit 50d80814 authored by Phil Hughes's avatar Phil Hughes

Fix last diff line not allowing suggestions

Fixes a bug where suggestion line would be -1
parent c788db1e
......@@ -126,7 +126,7 @@ export default {
const diffLines = this.diffFile[INLINE_DIFF_LINES_KEY];
let isAdding = false;
for (let i = 0, diffLinesLength = diffLines.length - 1; i < diffLinesLength; i += 1) {
for (let i = 0, diffLinesLength = diffLines.length - 1; i <= diffLinesLength; i += 1) {
const line = diffLines[i];
if (start.line_code === line.line_code) {
......
......@@ -168,6 +168,9 @@ export default {
false,
);
},
suggestionsStartIndex() {
return Math.max(this.lines.length - 1, 0);
},
},
watch: {
isSubmitting(isSubmitting) {
......@@ -260,7 +263,7 @@ export default {
:line-content="lineContent"
:can-suggest="canSuggest"
:show-suggest-popover="showSuggestPopover"
:suggestion-start-index="lines.length - 1"
:suggestion-start-index="suggestionsStartIndex"
@preview-markdown="showPreviewTab"
@write-markdown="showWriteTab"
@handleSuggestDismissed="() => $emit('handleSuggestDismissed')"
......
......@@ -29,7 +29,7 @@ exports[`Snippet Description Edit component rendering matches the snapshot 1`] =
>
<markdown-header-stub
linecontent=""
suggestionstartindex="-1"
suggestionstartindex="0"
/>
<div
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment