summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKushal Pandya <kushalspandya@gmail.com>2019-06-25 11:42:03 +0000
committerKushal Pandya <kushalspandya@gmail.com>2019-06-25 11:42:03 +0000
commit546355f734f74c040d0ef0917ade50751fd90731 (patch)
tree1a40935ecb508b52bf8b19114a1e55b4659f0e85
parent938db9132245b0b33574ffee3dfcf770aa005620 (diff)
parent875cba9d99b49ace61a5dfc52b4fe365893f4b37 (diff)
downloadgitlab-ce-546355f734f74c040d0ef0917ade50751fd90731.tar.gz
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
-rw-r--r--app/assets/javascripts/ide/stores/actions.js4
-rw-r--r--changelogs/unreleased/60860-keep-empty-folders-in-tree.yml5
-rw-r--r--spec/javascripts/ide/stores/actions_spec.js27
3 files changed, 32 insertions, 4 deletions
diff --git a/app/assets/javascripts/ide/stores/actions.js b/app/assets/javascripts/ide/stores/actions.js
index 5429b834708..48aabaf9dcf 100644
--- a/app/assets/javascripts/ide/stores/actions.js
+++ b/app/assets/javascripts/ide/stores/actions.js
@@ -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');
};
diff --git a/changelogs/unreleased/60860-keep-empty-folders-in-tree.yml b/changelogs/unreleased/60860-keep-empty-folders-in-tree.yml
new file mode 100644
index 00000000000..237d0fd6aef
--- /dev/null
+++ b/changelogs/unreleased/60860-keep-empty-folders-in-tree.yml
@@ -0,0 +1,5 @@
+---
+title: Keep the empty folders in the tree
+merge_request: 29196
+author:
+type: fixed
diff --git a/spec/javascripts/ide/stores/actions_spec.js b/spec/javascripts/ide/stores/actions_spec.js
index 37354283cab..537152f5eed 100644
--- a/spec/javascripts/ide/stores/actions_spec.js
+++ b/spec/javascripts/ide/stores/actions_spec.js
@@ -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', () => {