Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-21 15:07:52 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-21 15:07:52 +0300
commitab72cfc3b323f2a34bd4426b9a42c13cd345b284 (patch)
tree36c0a880a177e15c43e0117949a1e460d8342068 /app/assets/javascripts/ide/stores
parent483a66c030b55c7dc397d72946ba3853d0d24115 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/ide/stores')
-rw-r--r--app/assets/javascripts/ide/stores/actions/file.js39
1 files changed, 24 insertions, 15 deletions
diff --git a/app/assets/javascripts/ide/stores/actions/file.js b/app/assets/javascripts/ide/stores/actions/file.js
index 27b8e32bf5e..d444f6be21d 100644
--- a/app/assets/javascripts/ide/stores/actions/file.js
+++ b/app/assets/javascripts/ide/stores/actions/file.js
@@ -191,25 +191,34 @@ export const discardFileChanges = ({ dispatch, state, commit, getters }, path) =
dispatch('restoreTree', file.parentPath);
}
- commit(types.DISCARD_FILE_CHANGES, path);
- commit(types.REMOVE_FILE_FROM_CHANGED, path);
-
- if (file.prevPath) {
- dispatch('discardFileChanges', file.prevPath);
- }
+ if (file.tempFile || file.prevPath) {
+ dispatch('closeFile', file);
- if (file.tempFile && file.opened) {
- commit(types.TOGGLE_FILE_OPEN, path);
- } else if (getters.activeFile && file.path === getters.activeFile.path) {
- dispatch('updateDelayViewerUpdated', true)
- .then(() => {
- router.push(`/project${file.url}`);
- })
- .catch(e => {
- throw e;
+ if (file.tempFile) {
+ dispatch('deleteEntry', file.path);
+ } else {
+ dispatch('renameEntry', {
+ path: file.path,
+ name: file.prevName,
+ parentPath: file.prevParentPath,
});
+ }
+ } else {
+ commit(types.DISCARD_FILE_CHANGES, path);
+
+ if (getters.activeFile && file.path === getters.activeFile.path) {
+ dispatch('updateDelayViewerUpdated', true)
+ .then(() => {
+ router.push(`/project${file.url}`);
+ })
+ .catch(e => {
+ throw e;
+ });
+ }
}
+ commit(types.REMOVE_FILE_FROM_CHANGED, path);
+
eventHub.$emit(`editor.update.model.new.content.${file.key}`, file.content);
eventHub.$emit(`editor.update.model.dispose.unstaged-${file.key}`, file.content);
};