Commit 875cba9d authored by Denys Mishunov's avatar Denys Mishunov

Keep empty folders in the tree list

When removing the last file from a folder in WebIDE, do not remove the
folder from the view. We keep those to give users possibility to
re-upload files to the same folders.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/60860
parent b1038a3a
......@@ -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');
};
......
---
title: Keep the empty folders in the tree
merge_request: 29196
author:
type: fixed
......@@ -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', () => {
......
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