diff options
Diffstat (limited to 'app/assets/javascripts/ide/stores/actions.js')
-rw-r--r-- | app/assets/javascripts/ide/stores/actions.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/assets/javascripts/ide/stores/actions.js b/app/assets/javascripts/ide/stores/actions.js index 48aabaf9dcf..507dc363529 100644 --- a/app/assets/javascripts/ide/stores/actions.js +++ b/app/assets/javascripts/ide/stores/actions.js @@ -8,6 +8,7 @@ import * as types from './mutation_types'; import { decorateFiles } from '../lib/files'; import { stageKeys } from '../constants'; import service from '../services'; +import router from '../ide_router'; export const redirectToUrl = (self, url) => visitUrl(url); @@ -234,10 +235,15 @@ export const renameEntry = ( parentPath: newParentPath, }); }); - } + } else { + const newPath = parentPath ? `${parentPath}/${name}` : name; + const newEntry = state.entries[newPath]; + commit(types.TOGGLE_FILE_CHANGED, { file: newEntry, changed: true }); - if (!entryPath && !entry.tempFile) { - dispatch('deleteEntry', path); + if (entry.opened) { + router.push(`/project${newEntry.url}`); + commit(types.TOGGLE_FILE_OPEN, entry.path); + } } dispatch('triggerFilesChange'); |