Commit ac8895b7 authored by Phil Hughes's avatar Phil Hughes

Open first 10 merge request files in IDE

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/51635
parent 117fb448
......@@ -56,7 +56,10 @@ export const setFileActive = ({ commit, state, getters, dispatch }, path) => {
dispatch('scrollToTab');
};
export const getFileData = ({ state, commit, dispatch }, { path, makeFileActive = true }) => {
export const getFileData = (
{ state, commit, dispatch },
{ path, makeFileActive = true, openFile = makeFileActive },
) => {
const file = state.entries[path];
if (file.raw || (file.tempFile && !file.prevPath)) return Promise.resolve();
......@@ -72,7 +75,7 @@ export const getFileData = ({ state, commit, dispatch }, { path, makeFileActive
setPageTitle(decodeURI(normalizedHeaders['PAGE-TITLE']));
commit(types.SET_FILE_DATA, { data, file });
if (makeFileActive) commit(types.TOGGLE_FILE_OPEN, path);
if (openFile) commit(types.TOGGLE_FILE_OPEN, path);
if (makeFileActive) dispatch('setFileActive', path);
commit(types.TOGGLE_LOADING, { entry: file });
})
......
......@@ -161,6 +161,7 @@ export const openMergeRequest = (
dispatch('getFileData', {
path: change.new_path,
makeFileActive: ind === 0,
openFile: true,
});
}
}
......
---
title: Open first 10 merge request files in IDE
merge_request:
author:
type: fixed
......@@ -321,6 +321,7 @@ describe('IDE store merge request actions', () => {
expect(store.dispatch).toHaveBeenCalledWith('getFileData', {
path: change.new_path,
makeFileActive: i === 0,
openFile: true,
});
});
})
......
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