Commit 73406191 authored by Phil Hughes's avatar Phil Hughes

Fixed batch comments

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