Commit 8b0e52a2 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '118853-burst-unused-seal' into 'master'

Remove burstUnusedSeal action

See merge request gitlab-org/gitlab!24445
parents f0692d2a cfcff308
......@@ -86,7 +86,6 @@ export const createTempEntry = (
dispatch('setFileActive', file.path);
dispatch('triggerFilesChange');
dispatch('burstUnusedSeal');
}
if (parentPath && !state.entries[parentPath].opened) {
......@@ -175,12 +174,6 @@ export const updateTempFlagForEntry = ({ commit, dispatch, state }, { file, temp
export const toggleFileFinder = ({ commit }, fileFindVisible) =>
commit(types.TOGGLE_FILE_FINDER, fileFindVisible);
export const burstUnusedSeal = ({ state, commit }) => {
if (state.unusedSeal) {
commit(types.BURST_UNUSED_SEAL);
}
};
export const setLinks = ({ commit }, links) => commit(types.SET_LINKS, links);
export const setErrorMessage = ({ commit }, errorMessage) =>
......@@ -209,8 +202,6 @@ export const deleteEntry = ({ commit, dispatch, state }, path) => {
return;
}
dispatch('burstUnusedSeal');
if (entry.opened) dispatch('closeFile', entry);
if (isTree) {
......@@ -262,8 +253,6 @@ export const renameEntry = ({ dispatch, commit, state, getters }, { path, name,
if (gon.features?.stageAllByDefault)
commit(types.STAGE_CHANGE, { path: newPath, diffInfo: getters.getDiffInfo(newPath) });
else commit(types.ADD_FILE_TO_CHANGED, newPath);
dispatch('burstUnusedSeal');
}
if (!newEntry.tempFile) {
......
......@@ -148,7 +148,7 @@ export const getRawFileData = ({ state, commit, dispatch, getters }, { path }) =
});
};
export const changeFileContent = ({ commit, dispatch, state, getters }, { path, content }) => {
export const changeFileContent = ({ commit, state, getters }, { path, content }) => {
const file = state.entries[path];
commit(types.UPDATE_FILE_CONTENT, {
path,
......@@ -164,8 +164,6 @@ export const changeFileContent = ({ commit, dispatch, state, getters }, { path,
} else if (!file.changed && !file.tempFile && indexOfChangedFile !== -1) {
commit(types.REMOVE_FILE_FROM_CHANGED, path);
}
dispatch('burstUnusedSeal', {}, { root: true });
};
export const setFileLanguage = ({ getters, commit }, { fileLanguage }) => {
......
......@@ -67,7 +67,6 @@ export const REMOVE_PENDING_TAB = 'REMOVE_PENDING_TAB';
export const UPDATE_ACTIVITY_BAR_VIEW = 'UPDATE_ACTIVITY_BAR_VIEW';
export const UPDATE_TEMP_FLAG = 'UPDATE_TEMP_FLAG';
export const TOGGLE_FILE_FINDER = 'TOGGLE_FILE_FINDER';
export const BURST_UNUSED_SEAL = 'BURST_UNUSED_SEAL';
export const CLEAR_PROJECTS = 'CLEAR_PROJECTS';
export const RESET_OPEN_FILES = 'RESET_OPEN_FILES';
......
......@@ -180,11 +180,6 @@ export default {
});
}
},
[types.BURST_UNUSED_SEAL](state) {
Object.assign(state, {
unusedSeal: false,
});
},
[types.SET_LINKS](state, links) {
Object.assign(state, { links });
},
......@@ -226,6 +221,8 @@ export default {
state.changedFiles = state.changedFiles.concat(entry);
}
}
state.unusedSeal = false;
},
[types.RENAME_ENTRY](state, { path, name, parentPath }) {
const oldEntry = state.entries[path];
......
......@@ -153,11 +153,13 @@ export default {
[types.ADD_FILE_TO_CHANGED](state, path) {
Object.assign(state, {
changedFiles: state.changedFiles.concat(state.entries[path]),
unusedSeal: false,
});
},
[types.REMOVE_FILE_FROM_CHANGED](state, path) {
Object.assign(state, {
changedFiles: state.changedFiles.filter(f => f.path !== path),
unusedSeal: false,
});
},
[types.STAGE_CHANGE](state, { path, diffInfo }) {
......@@ -173,6 +175,7 @@ export default {
deleted: diffInfo.deleted,
}),
}),
unusedSeal: false,
});
if (stagedFile) {
......
......@@ -356,6 +356,14 @@ describe('IDE store file mutations', () => {
expect(localState.changedFiles.length).toBe(1);
});
it('bursts unused seal', () => {
expect(localState.unusedSeal).toBe(true);
mutations.ADD_FILE_TO_CHANGED(localState, localFile.path);
expect(localState.unusedSeal).toBe(false);
});
});
describe('REMOVE_FILE_FROM_CHANGED', () => {
......@@ -366,6 +374,14 @@ describe('IDE store file mutations', () => {
expect(localState.changedFiles.length).toBe(0);
});
it('bursts unused seal', () => {
expect(localState.unusedSeal).toBe(true);
mutations.REMOVE_FILE_FROM_CHANGED(localState, localFile.path);
expect(localState.unusedSeal).toBe(false);
});
});
describe.each`
......@@ -517,6 +533,19 @@ describe('IDE store file mutations', () => {
},
);
describe('STAGE_CHANGE', () => {
it('bursts unused seal', () => {
expect(localState.unusedSeal).toBe(true);
mutations.STAGE_CHANGE(localState, {
path: localFile.path,
diffInfo: localStore.getters.getDiffInfo(localFile.path),
});
expect(localState.unusedSeal).toBe(false);
});
});
describe('TOGGLE_FILE_CHANGED', () => {
it('updates file changed status', () => {
mutations.TOGGLE_FILE_CHANGED(localState, {
......
......@@ -196,16 +196,6 @@ describe('Multi-file store mutations', () => {
});
});
describe('BURST_UNUSED_SEAL', () => {
it('updates unusedSeal', () => {
expect(localState.unusedSeal).toBe(true);
mutations.BURST_UNUSED_SEAL(localState);
expect(localState.unusedSeal).toBe(false);
});
});
describe('SET_ERROR_MESSAGE', () => {
it('updates error message', () => {
mutations.SET_ERROR_MESSAGE(localState, 'error');
......@@ -297,6 +287,16 @@ describe('Multi-file store mutations', () => {
expect(localState.changedFiles).toEqual([]);
});
it('bursts unused seal', () => {
localState.entries.test = file('test');
expect(localState.unusedSeal).toBe(true);
mutations.DELETE_ENTRY(localState, 'test');
expect(localState.unusedSeal).toBe(false);
});
});
describe('UPDATE_FILE_AFTER_COMMIT', () => {
......
......@@ -591,11 +591,7 @@ describe('Multi-file store actions', () => {
'path',
store.state,
[{ type: types.DELETE_ENTRY, payload: 'path' }],
[
{ type: 'burstUnusedSeal' },
{ type: 'stageChange', payload: 'path' },
{ type: 'triggerFilesChange' },
],
[{ type: 'stageChange', payload: 'path' }, { type: 'triggerFilesChange' }],
done,
);
});
......@@ -623,7 +619,6 @@ describe('Multi-file store actions', () => {
store.state,
[{ type: types.DELETE_ENTRY, payload: 'testFolder/entry-to-delete' }],
[
{ type: 'burstUnusedSeal' },
{ type: 'stageChange', payload: 'testFolder/entry-to-delete' },
{ type: 'triggerFilesChange' },
],
......@@ -688,11 +683,7 @@ describe('Multi-file store actions', () => {
testEntry.path,
store.state,
[{ type: types.DELETE_ENTRY, payload: testEntry.path }],
[
{ type: 'burstUnusedSeal' },
{ type: 'stageChange', payload: testEntry.path },
{ type: 'triggerFilesChange' },
],
[{ type: 'stageChange', payload: testEntry.path }, { type: 'triggerFilesChange' }],
done,
);
});
......
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