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
This commit is contained in:
Kushal Pandya 2019-06-25 11:42:03 +00:00
commit 546355f734
3 changed files with 32 additions and 4 deletions

View File

@ -208,10 +208,6 @@ export const deleteEntry = ({ commit, dispatch, state }, path) => {
commit(types.DELETE_ENTRY, path);
if (entry.parentPath && state.entries[entry.parentPath].tree.length === 0) {
dispatch('deleteEntry', entry.parentPath);
}
dispatch('triggerFilesChange');
};

View File

@ -0,0 +1,5 @@
---
title: Keep the empty folders in the tree
merge_request: 29196
author:
type: fixed

View File

@ -492,6 +492,33 @@ describe('Multi-file store actions', () => {
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', () => {