Merge branch '64677-delete-directory-webide' into 'master'

Fixed deletion of directories in Web IDE

Closes #64677

See merge request gitlab-org/gitlab-ce!31727
This commit is contained in:
Paul Slaughter 2019-08-19 15:04:44 +00:00
commit 0d79fe7ed9
3 changed files with 41 additions and 1 deletions

View File

@ -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,

View File

@ -0,0 +1,5 @@
---
title: Fixed removing directories in Web IDE
merge_request: 31727
author:
type: fixed

View File

@ -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', () => {