From d31345203fabc5b5aaecefe41338f9730ad7a4ce Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 11 Mar 2015 09:44:42 -0400 Subject: [PATCH] fix(dom) renameCurrent: when there is file with same name - two same names is shown on a panel --- lib/client/dom.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index 0c442b33..8af34670 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -1531,7 +1531,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * @currentFile */ this.renameCurrent = function(current) { - var from, to, dirPath, files, + var from, to, dirPath, files, isExist, RESTful = DOM.RESTful; if (!Cmd.isCurrentFile(current)) @@ -1543,6 +1543,8 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; Dialog.alert('No files selected!'); } else { to = Dialog.prompt('Rename', from) || from; + isExist = !!DOM.getCurrentByName(to); + dirPath = Cmd.getCurrentDirPath(); if (from !== to) { @@ -1558,6 +1560,9 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; DOM.setCurrentName(to, current); Cmd.updateCurrentInfo(); Storage.remove(path); + + if (isExist) + CloudCmd.refresh(); }); } }