From 89c56c1fe4e8b9d0815fa768e8609383defb8677 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Mon, 30 Jul 2018 10:39:55 +0100 Subject: fixed folders not being renamed --- app/assets/javascripts/ide/stores/actions.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'app/assets/javascripts/ide/stores/actions.js') diff --git a/app/assets/javascripts/ide/stores/actions.js b/app/assets/javascripts/ide/stores/actions.js index 36ac76cb42e..6f70f297214 100644 --- a/app/assets/javascripts/ide/stores/actions.js +++ b/app/assets/javascripts/ide/stores/actions.js @@ -193,9 +193,16 @@ export const deleteEntry = ({ commit, dispatch, state }, path) => { export const resetOpenFiles = ({ commit }) => commit(types.RESET_OPEN_FILES); -export const renameEntry = ({ dispatch, commit }, { path, name }) => { - commit(types.RENAME_ENTRY, { path, name }); - dispatch('deleteEntry', path); +export const renameEntry = ({ dispatch, commit, state }, { path, name, entryPath = null }) => { + commit(types.RENAME_ENTRY, { path, name, entryPath }); + + state.entries[entryPath || path].tree.forEach(f => + dispatch('renameEntry', { path, name, entryPath: f.path }), + ); + + if (!entryPath) { + dispatch('deleteEntry', path); + } }; export * from './actions/tree'; -- cgit v1.2.1