Commit 24aaeb92 authored by Tim Zallmann's avatar Tim Zallmann Committed by Julius Kvedaras

Merge branch '48960-namespace-diff-module' into 'master'

Resolve "Use namespaped module for diffs"

Closes #48960

See merge request gitlab-org/gitlab-ce!20442
parent 2da13baa
...@@ -63,7 +63,8 @@ export default { ...@@ -63,7 +63,8 @@ export default {
plainDiffPath: state => state.diffs.plainDiffPath, plainDiffPath: state => state.diffs.plainDiffPath,
emailPatchPath: state => state.diffs.emailPatchPath, emailPatchPath: state => state.diffs.emailPatchPath,
}), }),
...mapGetters(['isParallelView', 'isNotesFetched']), ...mapGetters('diffs', ['isParallelView']),
...mapGetters(['isNotesFetched']),
targetBranch() { targetBranch() {
return { return {
branchName: this.targetBranchName, branchName: this.targetBranchName,
...@@ -115,7 +116,7 @@ export default { ...@@ -115,7 +116,7 @@ export default {
this.adjustView(); this.adjustView();
}, },
methods: { methods: {
...mapActions(['setBaseConfig', 'fetchDiffFiles']), ...mapActions('diffs', ['setBaseConfig', 'fetchDiffFiles']),
fetchData() { fetchData() {
this.fetchDiffFiles().catch(() => { this.fetchDiffFiles().catch(() => {
createFlash(__('Something went wrong on our end. Please try again!')); createFlash(__('Something went wrong on our end. Please try again!'));
......
...@@ -31,7 +31,7 @@ export default { ...@@ -31,7 +31,7 @@ export default {
}; };
}, },
computed: { computed: {
...mapGetters(['isInlineView', 'isParallelView', 'areAllFilesCollapsed']), ...mapGetters('diffs', ['isInlineView', 'isParallelView', 'areAllFilesCollapsed']),
sumAddedLines() { sumAddedLines() {
return this.sumValues('addedLines'); return this.sumValues('addedLines');
}, },
...@@ -66,7 +66,7 @@ export default { ...@@ -66,7 +66,7 @@ export default {
document.removeEventListener('scroll', this.handleScroll); document.removeEventListener('scroll', this.handleScroll);
}, },
methods: { methods: {
...mapActions(['setInlineDiffViewType', 'setParallelDiffViewType', 'expandAllFiles']), ...mapActions('diffs', ['setInlineDiffViewType', 'setParallelDiffViewType', 'expandAllFiles']),
pluralize, pluralize,
handleScroll() { handleScroll() {
if (!this.updating) { if (!this.updating) {
......
...@@ -22,7 +22,7 @@ export default { ...@@ -22,7 +22,7 @@ export default {
projectPath: state => state.diffs.projectPath, projectPath: state => state.diffs.projectPath,
endpoint: state => state.diffs.endpoint, endpoint: state => state.diffs.endpoint,
}), }),
...mapGetters(['isInlineView', 'isParallelView']), ...mapGetters('diffs', ['isInlineView', 'isParallelView']),
diffMode() { diffMode() {
const diffModeKey = Object.keys(diffModes).find(key => this.diffFile[`${key}File`]); const diffModeKey = Object.keys(diffModes).find(key => this.diffFile[`${key}File`]);
return diffModes[diffModeKey] || diffModes.replaced; return diffModes[diffModeKey] || diffModes.replaced;
......
...@@ -58,7 +58,7 @@ export default { ...@@ -58,7 +58,7 @@ export default {
document.removeEventListener('scroll', this.handleScroll); document.removeEventListener('scroll', this.handleScroll);
}, },
methods: { methods: {
...mapActions(['loadCollapsedDiff']), ...mapActions('diffs', ['loadCollapsedDiff']),
handleToggle() { handleToggle() {
const { collapsed, highlightedDiffLines, parallelDiffLines } = this.file; const { collapsed, highlightedDiffLines, parallelDiffLines } = this.file;
......
...@@ -108,7 +108,7 @@ export default { ...@@ -108,7 +108,7 @@ export default {
}, },
}, },
methods: { methods: {
...mapActions(['loadMoreLines', 'showCommentForm']), ...mapActions('diffs', ['loadMoreLines', 'showCommentForm']),
handleCommentButton() { handleCommentButton() {
this.showCommentForm({ lineCode: this.lineCode }); this.showCommentForm({ lineCode: this.lineCode });
}, },
......
...@@ -59,7 +59,8 @@ export default { ...@@ -59,7 +59,8 @@ export default {
} }
}, },
methods: { methods: {
...mapActions(['cancelCommentForm', 'saveNote', 'refetchDiscussionById']), ...mapActions('diffs', ['cancelCommentForm']),
...mapActions(['saveNote', 'refetchDiscussionById']),
handleCancelCommentForm() { handleCancelCommentForm() {
this.autosave.reset(); this.autosave.reset();
this.cancelCommentForm({ this.cancelCommentForm({
......
...@@ -36,7 +36,7 @@ export default { ...@@ -36,7 +36,7 @@ export default {
}; };
}, },
computed: { computed: {
...mapGetters(['isInlineView']), ...mapGetters('diffs', ['isInlineView']),
isContextLine() { isContextLine() {
return this.line.type === CONTEXT_LINE_TYPE; return this.line.type === CONTEXT_LINE_TYPE;
}, },
......
...@@ -20,7 +20,8 @@ export default { ...@@ -20,7 +20,8 @@ export default {
}, },
}, },
computed: { computed: {
...mapGetters(['commitId', 'discussionsByLineCode']), ...mapGetters('diffs', ['commitId']),
...mapGetters(['discussionsByLineCode']),
...mapState({ ...mapState({
diffLineCommentForms: state => state.diffs.diffLineCommentForms, diffLineCommentForms: state => state.diffs.diffLineCommentForms,
}), }),
......
...@@ -40,7 +40,7 @@ export default { ...@@ -40,7 +40,7 @@ export default {
}; };
}, },
computed: { computed: {
...mapGetters(['isParallelView']), ...mapGetters('diffs', ['isParallelView']),
isContextLine() { isContextLine() {
return this.line.left.type === CONTEXT_LINE_TYPE; return this.line.left.type === CONTEXT_LINE_TYPE;
}, },
......
...@@ -21,7 +21,8 @@ export default { ...@@ -21,7 +21,8 @@ export default {
}, },
}, },
computed: { computed: {
...mapGetters(['commitId', 'discussionsByLineCode']), ...mapGetters('diffs', ['commitId']),
...mapGetters(['discussionsByLineCode']),
...mapState({ ...mapState({
diffLineCommentForms: state => state.diffs.diffLineCommentForms, diffLineCommentForms: state => state.diffs.diffLineCommentForms,
}), }),
......
...@@ -4,6 +4,7 @@ import mutations from '../mutations'; ...@@ -4,6 +4,7 @@ import mutations from '../mutations';
import createState from './diff_state'; import createState from './diff_state';
export default { export default {
namespaced: true,
state: createState(), state: createState(),
getters, getters,
actions, actions,
......
...@@ -13,7 +13,7 @@ describe('InlineDiffView', () => { ...@@ -13,7 +13,7 @@ describe('InlineDiffView', () => {
beforeEach(() => { beforeEach(() => {
const diffFile = getDiffFileMock(); const diffFile = getDiffFileMock();
store.dispatch('setInlineDiffViewType'); store.dispatch('diffs/setInlineDiffViewType');
component = createComponentWithStore(Vue.extend(InlineDiffView), store, { component = createComponentWithStore(Vue.extend(InlineDiffView), store, {
diffFile, diffFile,
diffLines: diffFile.highlightedDiffLines, diffLines: diffFile.highlightedDiffLines,
......
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