Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
177a5e69
Commit
177a5e69
authored
Aug 15, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed deleting new files creating wrong state in IDE
Closes #50255
parent
7ff0dbc5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
1 deletion
+38
-1
app/assets/javascripts/ide/stores/mutations.js
app/assets/javascripts/ide/stores/mutations.js
+6
-1
changelogs/unreleased/ide-delete-new-files-state.yml
changelogs/unreleased/ide-delete-new-files-state.yml
+5
-0
spec/javascripts/ide/stores/mutations_spec.js
spec/javascripts/ide/stores/mutations_spec.js
+27
-0
No files found.
app/assets/javascripts/ide/stores/mutations.js
View file @
177a5e69
...
@@ -200,6 +200,7 @@ export default {
...
@@ -200,6 +200,7 @@ export default {
},
},
[
types
.
DELETE_ENTRY
](
state
,
path
)
{
[
types
.
DELETE_ENTRY
](
state
,
path
)
{
const
entry
=
state
.
entries
[
path
];
const
entry
=
state
.
entries
[
path
];
const
{
tempFile
=
false
}
=
entry
;
const
parent
=
entry
.
parentPath
const
parent
=
entry
.
parentPath
?
state
.
entries
[
entry
.
parentPath
]
?
state
.
entries
[
entry
.
parentPath
]
:
state
.
trees
[
`
${
state
.
currentProjectId
}
/
${
state
.
currentBranchId
}
`
];
:
state
.
trees
[
`
${
state
.
currentProjectId
}
/
${
state
.
currentBranchId
}
`
];
...
@@ -209,7 +210,11 @@ export default {
...
@@ -209,7 +210,11 @@ export default {
parent
.
tree
=
parent
.
tree
.
filter
(
f
=>
f
.
path
!==
entry
.
path
);
parent
.
tree
=
parent
.
tree
.
filter
(
f
=>
f
.
path
!==
entry
.
path
);
if
(
entry
.
type
===
'
blob
'
)
{
if
(
entry
.
type
===
'
blob
'
)
{
state
.
changedFiles
=
state
.
changedFiles
.
concat
(
entry
);
if
(
tempFile
)
{
state
.
changedFiles
=
state
.
changedFiles
.
filter
(
f
=>
f
.
path
!==
path
);
}
else
{
state
.
changedFiles
=
state
.
changedFiles
.
concat
(
entry
);
}
}
}
},
},
[
types
.
RENAME_ENTRY
](
state
,
{
path
,
name
,
entryPath
=
null
})
{
[
types
.
RENAME_ENTRY
](
state
,
{
path
,
name
,
entryPath
=
null
})
{
...
...
changelogs/unreleased/ide-delete-new-files-state.yml
0 → 100644
View file @
177a5e69
---
title
:
Fixed IDE deleting new files creating wrong state
merge_request
:
author
:
type
:
fixed
spec/javascripts/ide/stores/mutations_spec.js
View file @
177a5e69
...
@@ -213,6 +213,33 @@ describe('Multi-file store mutations', () => {
...
@@ -213,6 +213,33 @@ describe('Multi-file store mutations', () => {
expect
(
localState
.
changedFiles
).
toEqual
([
localState
.
entries
.
filePath
]);
expect
(
localState
.
changedFiles
).
toEqual
([
localState
.
entries
.
filePath
]);
});
});
it
(
'
does not add tempFile into changedFiles
'
,
()
=>
{
localState
.
entries
.
filePath
=
{
deleted
:
false
,
type
:
'
blob
'
,
tempFile
:
true
,
};
mutations
.
DELETE_ENTRY
(
localState
,
'
filePath
'
);
expect
(
localState
.
changedFiles
).
toEqual
([]);
});
it
(
'
removes tempFile from changedFiles when deleted
'
,
()
=>
{
localState
.
entries
.
filePath
=
{
path
:
'
filePath
'
,
deleted
:
false
,
type
:
'
blob
'
,
tempFile
:
true
,
};
localState
.
changedFiles
.
push
({
...
localState
.
entries
.
filePath
});
mutations
.
DELETE_ENTRY
(
localState
,
'
filePath
'
);
expect
(
localState
.
changedFiles
).
toEqual
([]);
});
});
});
describe
(
'
UPDATE_FILE_AFTER_COMMIT
'
,
()
=>
{
describe
(
'
UPDATE_FILE_AFTER_COMMIT
'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment