Commit e6b77c83 authored by Thomas Randolph's avatar Thomas Randolph

Load the user settings endpoint into the diffs app

parent 1e2ae8e5
......@@ -89,6 +89,11 @@ export default {
required: false,
default: '',
},
endpointUpdateUser: {
type: String,
required: false,
default: '',
},
projectPath: {
type: String,
required: true,
......@@ -283,6 +288,7 @@ export default {
endpointBatch: this.endpointBatch,
endpointCoverage: this.endpointCoverage,
endpointCodequality: this.endpointCodequality,
endpointUpdateUser: this.endpointUpdateUser,
projectPath: this.projectPath,
dismissEndpoint: this.dismissEndpoint,
showSuggestPopover: this.showSuggestPopover,
......
......@@ -74,6 +74,7 @@ export default function initDiffsApp(store) {
endpointBatch: dataset.endpointBatch || '',
endpointCoverage: dataset.endpointCoverage || '',
endpointCodequality: dataset.endpointCodequality || '',
endpointUpdateUser: dataset.updateCurrentUserPath,
projectPath: dataset.projectPath,
helpPagePath: dataset.helpPagePath,
currentUser: JSON.parse(dataset.currentUserData) || {},
......@@ -116,6 +117,7 @@ export default function initDiffsApp(store) {
endpointBatch: this.endpointBatch,
endpointCoverage: this.endpointCoverage,
endpointCodequality: this.endpointCodequality,
endpointUpdateUser: this.endpointUpdateUser,
currentUser: this.currentUser,
projectPath: this.projectPath,
helpPagePath: this.helpPagePath,
......
......@@ -62,6 +62,7 @@ export const setBaseConfig = ({ commit }, options) => {
endpointBatch,
endpointCoverage,
endpointCodequality,
endpointUpdateUser,
projectPath,
dismissEndpoint,
showSuggestPopover,
......@@ -75,6 +76,7 @@ export const setBaseConfig = ({ commit }, options) => {
endpointBatch,
endpointCoverage,
endpointCodequality,
endpointUpdateUser,
projectPath,
dismissEndpoint,
showSuggestPopover,
......
......@@ -23,6 +23,7 @@ export default () => ({
addedLines: null,
removedLines: null,
endpoint: '',
endpointUpdateUser: '',
basePath: '',
commit: null,
startVersion: null, // Null unless a target diff is selected for comparison that is not the "base" diff
......
......@@ -34,6 +34,7 @@ export default {
endpointBatch,
endpointCoverage,
endpointCodequality,
endpointUpdateUser,
projectPath,
dismissEndpoint,
showSuggestPopover,
......@@ -47,6 +48,7 @@ export default {
endpointBatch,
endpointCoverage,
endpointCodequality,
endpointUpdateUser,
projectPath,
dismissEndpoint,
showSuggestPopover,
......
......@@ -7,15 +7,17 @@ import diffFileMockData from '../mock_data/diff_file';
describe('DiffsStoreMutations', () => {
describe('SET_BASE_CONFIG', () => {
it('should set endpoint and project path', () => {
it.each`
prop | value
${'endpoint'} | ${'/diffs/endpoint'}
${'projectPath'} | ${'/root/project'}
${'endpointUpdateUser'} | ${'/user/preferences'}
`('should set the $prop property into state', ({ prop, value }) => {
const state = {};
const endpoint = '/diffs/endpoint';
const projectPath = '/root/project';
mutations[types.SET_BASE_CONFIG](state, { endpoint, projectPath });
mutations[types.SET_BASE_CONFIG](state, { [prop]: value });
expect(state.endpoint).toEqual(endpoint);
expect(state.projectPath).toEqual(projectPath);
expect(state[prop]).toEqual(value);
});
});
......
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