diff --git a/app/assets/javascripts/diffs/components/app.vue b/app/assets/javascripts/diffs/components/app.vue index 77cd2afc10617a89c8e2fbc189b08ac8288e7d7d..06f96eff758c0f3cd516d2d7ba77b56fa1ce844f 100644 --- a/app/assets/javascripts/diffs/components/app.vue +++ b/app/assets/javascripts/diffs/components/app.vue @@ -88,6 +88,11 @@ export default { required: false, default: false, }, + viewDiffsFileByFile: { + type: Boolean, + required: false, + default: false, + }, }, data() { const treeWidth = @@ -115,9 +120,14 @@ export default { emailPatchPath: state => state.diffs.emailPatchPath, retrievingBatches: state => state.diffs.retrievingBatches, }), - ...mapState('diffs', ['showTreeList', 'isLoading', 'startVersion']), + ...mapState('diffs', ['showTreeList', 'isLoading', 'startVersion', 'currentDiffFileId']), ...mapGetters('diffs', ['isParallelView', 'currentDiffIndex']), ...mapGetters(['isNotesFetched', 'getNoteableData']), + currentFile() { + return ( + this.diffFiles.find(file => file.file_hash === this.currentDiffFileId) || this.diffFiles[0] + ); + }, targetBranch() { return { branchName: this.targetBranchName, @@ -172,6 +182,7 @@ export default { projectPath: this.projectPath, dismissEndpoint: this.dismissEndpoint, showSuggestPopover: this.showSuggestPopover, + viewDiffsFileByFile: this.viewDiffsFileByFile, useSingleDiffStyle: this.glFeatures.singleMrDiffView, }); @@ -400,8 +411,17 @@ export default {