]> source.dussan.org Git - nextcloud-server.git/commitdiff
Disable JS plugin for sharing in public mode
authorVincent Petry <pvince81@owncloud.com>
Mon, 26 Jan 2015 16:06:07 +0000 (17:06 +0100)
committerVincent Petry <pvince81@owncloud.com>
Mon, 26 Jan 2015 18:55:48 +0000 (19:55 +0100)
This removes the logic that registers the share action and modifies the
rows. Share actions aren't needed in the public file list.

apps/files_sharing/js/share.js
apps/files_sharing/tests/js/shareSpec.js

index 3a16c1f2edd560739364574e40f3798d437883e4..11c3170c2f09efea451f0eb48968ad2e070db0b9 100644 (file)
@@ -25,7 +25,7 @@
                 * @param {OCA.Files.FileList} fileList file list to be extended
                 */
                attach: function(fileList) {
-                       if (fileList.id === 'trashbin') {
+                       if (fileList.id === 'trashbin' || fileList.id === 'files.public') {
                                return;
                        }
                        var fileActions = fileList.fileActions;
index e5b5de314d7301886c4da2c4228884601d753556..1b1e363b792ab1247f7a79d3dd26b23cef89a965 100644 (file)
@@ -27,7 +27,7 @@ describe('OCA.Sharing.Util tests', function() {
                $('#testArea').append($content);
                // dummy file list
                var $div = $(
-                       '<div>' +
+                       '<div id="listContainer">' +
                        '<table id="filestable">' +
                        '<thead></thead>' +
                        '<tbody id="fileList"></tbody>' +
@@ -450,5 +450,29 @@ describe('OCA.Sharing.Util tests', function() {
                                .toEqual('User four, User one, User three, User two, +6');
                });
        });
+       describe('Excluded lists', function() {
+               function createListThenAttach(listId) {
+                       var fileActions = new OCA.Files.FileActions();
+                       fileList.destroy();
+                       fileList = new OCA.Files.FileList(
+                               $('#listContainer'), {
+                                       id: listId,
+                                       fileActions: fileActions
+                               }
+                       );
+                       OCA.Sharing.Util.attach(fileList);
+                       fileList.setFiles(testFiles);
+                       return fileList;
+               }
+
+               it('does not attach to trashbin or public file lists', function() {
+                       createListThenAttach('trashbin');
+                       expect($('.action-share').length).toEqual(0);
+                       expect($('[data-share-recipient]').length).toEqual(0);
+                       createListThenAttach('files.public');
+                       expect($('.action-share').length).toEqual(0);
+                       expect($('[data-share-recipient]').length).toEqual(0);
+               });
+       });
        
 });