summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-06-23 15:53:23 +0200
committerVincent Petry <pvince81@owncloud.com>2014-06-23 15:53:23 +0200
commit6850d0c6d72e2bb1837e2ee76a4da3e2b8e6509f (patch)
tree79871e8abde4d6e5a0873079f6cb9b960e5e0f7e
parent8c8209828126a55b9bf775e00cbc14d7ef7db5ae (diff)
parentd3d0035a9a81ea5d3e314141069f4914e3c6ce54 (diff)
downloadnextcloud-server-6850d0c6d72e2bb1837e2ee76a4da3e2b8e6509f.tar.gz
nextcloud-server-6850d0c6d72e2bb1837e2ee76a4da3e2b8e6509f.zip
Merge pull request #8931 from owncloud/filelist-usepathforaction
[master] Use actual file path on rename/delete
-rw-r--r--apps/files/js/fileactions.js2
-rw-r--r--apps/files/js/filelist.js2
-rw-r--r--apps/files/tests/js/fileactionsSpec.js3
-rw-r--r--apps/files/tests/js/filelistSpec.js6
4 files changed, 9 insertions, 4 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index 5bd75ac6287..47a6ab2f04b 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -257,7 +257,7 @@
this.register('all', 'Delete', OC.PERMISSION_DELETE, function () {
return OC.imagePath('core', 'actions/delete');
}, function (filename, context) {
- context.fileList.do_delete(filename);
+ context.fileList.do_delete(filename, context.dir);
$('.tipsy').remove();
});
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index fb97b2f4595..d5e16f9e20e 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -1219,7 +1219,7 @@
$.ajax({
url: OC.filePath('files','ajax','rename.php'),
data: {
- dir : self.getCurrentDirectory(),
+ dir : tr.attr('data-path') || self.getCurrentDirectory(),
newname: newName,
file: oldname
},
diff --git a/apps/files/tests/js/fileactionsSpec.js b/apps/files/tests/js/fileactionsSpec.js
index 490594a1773..355761afa01 100644
--- a/apps/files/tests/js/fileactionsSpec.js
+++ b/apps/files/tests/js/fileactionsSpec.js
@@ -140,6 +140,7 @@ describe('OCA.Files.FileActions tests', function() {
id: 18,
type: 'file',
name: 'testName.txt',
+ path: '/somepath/dir',
mimetype: 'text/plain',
size: '1234',
etag: 'a01234c',
@@ -151,6 +152,8 @@ describe('OCA.Files.FileActions tests', function() {
$tr.find('.action.delete').click();
expect(deleteStub.calledOnce).toEqual(true);
+ expect(deleteStub.getCall(0).args[0]).toEqual('testName.txt');
+ expect(deleteStub.getCall(0).args[1]).toEqual('/somepath/dir');
deleteStub.restore();
});
it('passes context to action handler', function() {
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index 743ebf9706a..5b72a1355cf 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -485,7 +485,9 @@ describe('OCA.Files.FileList tests', function() {
var $input, request;
for (var i = 0; i < testFiles.length; i++) {
- fileList.add(testFiles[i], {silent: true});
+ var file = testFiles[i];
+ file.path = '/some/subdir';
+ fileList.add(file, {silent: true});
}
// trigger rename prompt
@@ -498,7 +500,7 @@ describe('OCA.Files.FileList tests', function() {
expect(fakeServer.requests.length).toEqual(1);
request = fakeServer.requests[0];
expect(request.url.substr(0, request.url.indexOf('?'))).toEqual(OC.webroot + '/index.php/apps/files/ajax/rename.php');
- expect(OC.parseQueryString(request.url)).toEqual({'dir': '/subdir', newname: 'Tu_after_three.txt', file: 'One.txt'});
+ expect(OC.parseQueryString(request.url)).toEqual({'dir': '/some/subdir', newname: 'Tu_after_three.txt', file: 'One.txt'});
}
it('Inserts renamed file entry at correct position if rename ajax call suceeded', function() {
doRename();