Fix issue when renaming creates a separate entry

This commit is contained in:
Vincent Petry 2015-11-19 11:42:17 +01:00 committed by Lukas Reschke
parent ec3166742b
commit d3383adb71
1 changed files with 5 additions and 8 deletions

View File

@ -1806,10 +1806,8 @@
} }
function updateInList(fileInfo) { function updateInList(fileInfo) {
tr.remove(); self.updateRow(tr, fileInfo);
tr = self.add(fileInfo, {updateSummary: false, silent: true}); self._updateDetailsView(fileInfo.name, false);
self.$fileList.trigger($.Event('fileActionsReady', {fileList: self, $files: $(tr)}));
self._updateDetailsView(fileInfo.name);
} }
// TODO: too many nested blocks, move parts into functions // TODO: too many nested blocks, move parts into functions
@ -1838,11 +1836,10 @@
td.children('a.name').show(); td.children('a.name').show();
var path = tr.attr('data-path') || self.getCurrentDirectory(); var path = tr.attr('data-path') || self.getCurrentDirectory();
self.filesClient.move(path + '/' + oldName, path + '/' + newName) self.filesClient.move(OC.joinPaths(path, oldName), OC.joinPaths(path, newName))
.done(function() { .done(function() {
var fileInfo = self.files.splice(tr.index(), 1)[0]; oldFileInfo.name = newName;
fileInfo.name = newName; updateInList(oldFileInfo);
updateInList(fileInfo);
}) })
.fail(function(status) { .fail(function(status) {
// TODO: 409 means current folder does not exist, redirect ? // TODO: 409 means current folder does not exist, redirect ?