diff options
author | Denys Mishunov <dmishunov@gitlab.com> | 2019-08-12 18:13:12 +0200 |
---|---|---|
committer | Denys Mishunov <dmishunov@gitlab.com> | 2019-08-12 18:19:38 +0200 |
commit | 4882303760c9f22112985f78746f2416b701a47b (patch) | |
tree | e31ee10ca4df5b7dba10a93a5ddc4a1c1f65e005 | |
parent | 7a22b4bae55ba3afcc6fc961e6a0aeb47c7bd937 (diff) | |
download | gitlab-ce-64677-delete-directory-webide.tar.gz |
Fixed deletion of directories in Web IDE64677-delete-directory-webide
-rw-r--r-- | app/assets/javascripts/ide/stores/utils.js | 2 | ||||
-rw-r--r-- | changelogs/unreleased/64677-delete-directory-webide.yml | 5 | ||||
-rw-r--r-- | spec/javascripts/ide/stores/utils_spec.js | 35 |
3 files changed, 41 insertions, 1 deletions
diff --git a/app/assets/javascripts/ide/stores/utils.js b/app/assets/javascripts/ide/stores/utils.js index 04e86afb268..52200ce7847 100644 --- a/app/assets/javascripts/ide/stores/utils.js +++ b/app/assets/javascripts/ide/stores/utils.js @@ -129,7 +129,7 @@ export const commitActionForFile = file => { export const getCommitFiles = stagedFiles => stagedFiles.reduce((acc, file) => { - if (file.moved) return acc; + if (file.moved || file.type === 'tree') return acc; return acc.concat({ ...file, diff --git a/changelogs/unreleased/64677-delete-directory-webide.yml b/changelogs/unreleased/64677-delete-directory-webide.yml new file mode 100644 index 00000000000..27d596b6b19 --- /dev/null +++ b/changelogs/unreleased/64677-delete-directory-webide.yml @@ -0,0 +1,5 @@ +--- +title: Fixed removing directories in Web IDE +merge_request: 31727 +author: +type: fixed diff --git a/spec/javascripts/ide/stores/utils_spec.js b/spec/javascripts/ide/stores/utils_spec.js index bceb3a8db91..0fc9519a6bf 100644 --- a/spec/javascripts/ide/stores/utils_spec.js +++ b/spec/javascripts/ide/stores/utils_spec.js @@ -261,6 +261,41 @@ describe('Multi-file store utils', () => { }, ]); }); + + it('filters out folders from the list', () => { + const files = [ + { + path: 'a', + type: 'blob', + deleted: true, + }, + { + path: 'c', + type: 'tree', + deleted: true, + }, + { + path: 'c/d', + type: 'blob', + deleted: true, + }, + ]; + + const flattendFiles = utils.getCommitFiles(files); + + expect(flattendFiles).toEqual([ + { + path: 'a', + type: 'blob', + deleted: true, + }, + { + path: 'c/d', + type: 'blob', + deleted: true, + }, + ]); + }); }); describe('mergeTrees', () => { |