From f1bfe35cda2f11d1b38726cf2d4f879427b2c8d5 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 4 Sep 2014 19:58:49 +0200 Subject: Added permission check for drag and drop When dropping files onto a read-only folder, a notification is now shown instead of attempting to upload. This for both the drag for upload and drag from inside the file list cases. --- apps/files/tests/js/filelistSpec.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'apps/files/tests') diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js index cad564323b4..65a89ef85cd 100644 --- a/apps/files/tests/js/filelistSpec.js +++ b/apps/files/tests/js/filelistSpec.js @@ -1835,7 +1835,6 @@ describe('OCA.Files.FileList tests', function() { // but it makes it possible to simulate the event triggering to // test the response of the handlers $uploader = $('#file_upload_start'); - fileList.setupUploadEvents(); fileList.setFiles(testFiles); }); @@ -1912,6 +1911,16 @@ describe('OCA.Files.FileList tests', function() { ev = dropOn(fileList.$fileList.find('th:first')); expect(ev.result).toEqual(false); + expect(notificationStub.calledOnce).toEqual(true); + }); + it('drop on an folder does not trigger upload if no upload permission on that folder', function() { + var $tr = fileList.findFileEl('somedir'); + var ev; + $tr.data('permissions', OC.PERMISSION_READ); + ev = dropOn($tr); + + expect(ev.result).toEqual(false); + expect(notificationStub.calledOnce).toEqual(true); }); it('drop on a file row inside the table triggers upload to current folder', function() { var ev; -- cgit v1.2.3