Commit 546355f7 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '60860-keep-empty-folders-in-tree' into 'master'

Keep empty folders in the tree list

Closes #60860

See merge request gitlab-org/gitlab-ce!29196
parents 938db913 875cba9d
...@@ -208,10 +208,6 @@ export const deleteEntry = ({ commit, dispatch, state }, path) => { ...@@ -208,10 +208,6 @@ export const deleteEntry = ({ commit, dispatch, state }, path) => {
commit(types.DELETE_ENTRY, path); commit(types.DELETE_ENTRY, path);
if (entry.parentPath && state.entries[entry.parentPath].tree.length === 0) {
dispatch('deleteEntry', entry.parentPath);
}
dispatch('triggerFilesChange'); dispatch('triggerFilesChange');
}; };
......
---
title: Keep the empty folders in the tree
merge_request: 29196
author:
type: fixed
...@@ -492,6 +492,33 @@ describe('Multi-file store actions', () => { ...@@ -492,6 +492,33 @@ describe('Multi-file store actions', () => {
done, done,
); );
}); });
it('does not delete a folder after it is emptied', done => {
const testFolder = {
type: 'tree',
tree: [],
};
const testEntry = {
path: 'testFolder/entry-to-delete',
parentPath: 'testFolder',
opened: false,
tree: [],
};
testFolder.tree.push(testEntry);
store.state.entries = {
testFolder,
'testFolder/entry-to-delete': testEntry,
};
testAction(
deleteEntry,
'testFolder/entry-to-delete',
store.state,
[{ type: types.DELETE_ENTRY, payload: 'testFolder/entry-to-delete' }],
[{ type: 'burstUnusedSeal' }, { type: 'triggerFilesChange' }],
done,
);
});
}); });
describe('renameEntry', () => { describe('renameEntry', () => {
......
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