Commit eb2ea686 authored by Thomas Randolph's avatar Thomas Randolph

Provide file reviews to Diff Files in the Diffs App

parent 6865570d
......@@ -124,6 +124,11 @@ export default {
required: false,
default: false,
},
mrReviews: {
type: Object,
required: false,
default: () => ({}),
},
},
data() {
const treeWidth =
......@@ -161,7 +166,12 @@ export default {
'hasConflicts',
'viewDiffsFileByFile',
]),
...mapGetters('diffs', ['whichCollapsedTypes', 'isParallelView', 'currentDiffIndex']),
...mapGetters('diffs', [
'whichCollapsedTypes',
'isParallelView',
'currentDiffIndex',
'fileReviews',
]),
...mapGetters(['isNotesFetched', 'getNoteableData']),
diffs() {
if (!this.viewDiffsFileByFile) {
......@@ -261,6 +271,7 @@ export default {
dismissEndpoint: this.dismissEndpoint,
showSuggestPopover: this.showSuggestPopover,
viewDiffsFileByFile: fileByFile(this.fileByFileUserPreference),
mrReviews: this.mrReviews || {},
});
if (this.shouldShow) {
......@@ -519,6 +530,7 @@ export default {
v-for="(file, index) in diffs"
:key="file.newPath"
:file="file"
:reviewed="fileReviews[index]"
:is-first-file="index === 0"
:is-last-file="index === diffs.length - 1"
:help-page-path="helpPagePath"
......
......@@ -37,6 +37,11 @@ export default {
type: Object,
required: true,
},
reviewed: {
type: Boolean,
required: false,
default: false,
},
isFirstFile: {
type: Boolean,
required: false,
......
......@@ -5,6 +5,10 @@ import { parseBoolean } from '~/lib/utils/common_utils';
import FindFile from '~/vue_shared/components/file_finder/index.vue';
import eventHub from '../notes/event_hub';
import diffsApp from './components/app.vue';
import { getDerivedMergeRequestInformation } from './utils/merge_request';
import { getReviewsForMergeRequest } from './utils/file_reviews';
import { TREE_LIST_STORAGE_KEY, DIFF_WHITESPACE_COOKIE_NAME } from './constants';
export default function initDiffsApp(store) {
......@@ -102,6 +106,8 @@ export default function initDiffsApp(store) {
...mapActions('diffs', ['setRenderTreeList', 'setShowWhitespace']),
},
render(createElement) {
const { mrPath } = getDerivedMergeRequestInformation({ endpoint: this.endpoint });
return createElement('diffs-app', {
props: {
endpoint: this.endpoint,
......@@ -117,6 +123,7 @@ export default function initDiffsApp(store) {
dismissEndpoint: this.dismissEndpoint,
showSuggestPopover: this.showSuggestPopover,
fileByFileUserPreference: this.viewDiffsFileByFile,
mrReviews: getReviewsForMergeRequest(mrPath),
},
});
},
......
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