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