Commit 73406191 authored by Phil Hughes's avatar Phil Hughes

Fixed batch comments

parent 290f8281
......@@ -60,9 +60,9 @@ export default {
:line-index="index"
/>
<inline-draft-comment-row
v-if="shouldRenderDraftRow(diffFile.fileHash, line)"
v-if="shouldRenderDraftRow(diffFile.file_hash, line)"
:key="`draft_${index}`"
:draft="draftForLine(diffFile.fileHash, line)"
:draft="draftForLine(diffFile.file_hash, line)"
/>
</template>
</tbody>
......
......@@ -62,10 +62,10 @@ export default {
:line-index="index"
/>
<parallel-draft-comment-row
v-if="shouldRenderParallelDraftRow(diffFile.fileHash, line)"
v-if="shouldRenderParallelDraftRow(diffFile.file_hash, line)"
:key="`drafts-${index}`"
:line="line"
:diff-file-content-sha="diffFile.fileHash"
:diff-file-content-sha="diffFile.file_hash"
/>
</template>
</tbody>
......
......@@ -55,7 +55,7 @@ export default {
return this.saveDraft(postData)
.then(() => {
this.handleClearForm(this.line.lineCode);
this.handleClearForm(this.line.line_code);
})
.catch(() => {
createFlash(s__('MergeRequests|An error occurred while saving the draft comment.'));
......
......@@ -31,7 +31,7 @@ export const draftsPerFileHashAndLine = state =>
export const shouldRenderDraftRow = (state, getters) => (diffFileSha, line) =>
!!(
diffFileSha in getters.draftsPerFileHashAndLine &&
getters.draftsPerFileHashAndLine[diffFileSha][line.lineCode]
getters.draftsPerFileHashAndLine[diffFileSha][line.line_code]
);
export const shouldRenderParallelDraftRow = (state, getters) => (diffFileSha, line) => {
......@@ -50,7 +50,7 @@ export const draftForDiscussion = (state, getters) => discussionId =>
export const draftForLine = (state, getters) => (diffFileSha, line, side = null) => {
const draftsForFile = getters.draftsPerFileHashAndLine[diffFileSha];
const key = side !== null ? parallelLineKey(line, side) : line.lineCode;
const key = side !== null ? parallelLineKey(line, side) : line.line_code;
if (draftsForFile) {
const draft = draftsForFile[key];
......
......@@ -10,7 +10,7 @@ export const getDraftFormData = params => ({
data: getFormData(params),
});
export const parallelLineKey = (line, side) => (line[side] ? line[side].lineCode : '');
export const parallelLineKey = (line, side) => (line[side] ? line[side].line_code : '');
export const showDraftOnSide = (line, side) => {
// inline mode
......@@ -21,8 +21,8 @@ export const showDraftOnSide = (line, side) => {
// parallel
if (side === 'left' || side === 'right') {
const otherSide = side === 'left' ? 'right' : 'left';
const thisCode = (line[side] && line[side].lineCode) || '';
const otherCode = (line[otherSide] && line[otherSide].lineCode) || '';
const thisCode = (line[side] && line[side].line_code) || '';
const otherCode = (line[otherSide] && line[otherSide].line_code) || '';
// either the lineCodes are different
// or if they're the same, only show on the left side
......
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