diff options
author | Björn Schießle <schiessle@owncloud.com> | 2014-04-24 18:45:45 +0200 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2014-04-24 18:45:45 +0200 |
commit | f520305848be6994a0726d907a0182aa07da0be8 (patch) | |
tree | a5c05f26cf6f9a21dd1bc82abf517634199543e2 /apps/files/js | |
parent | 40257d9736ce0d7bad02bf4a1baa86d9b1fc8f7f (diff) | |
parent | b312d38d38c4e391765beb0aadb6bd2eafd9cb2c (diff) | |
download | nextcloud-server-f520305848be6994a0726d907a0182aa07da0be8.tar.gz nextcloud-server-f520305848be6994a0726d907a0182aa07da0be8.zip |
Merge pull request #8026 from owncloud/remove_shared_folder
remove the "Shared" folder
Diffstat (limited to 'apps/files/js')
-rw-r--r-- | apps/files/js/file-upload.js | 4 | ||||
-rw-r--r-- | apps/files/js/fileactions.js | 8 | ||||
-rw-r--r-- | apps/files/js/filelist.js | 15 | ||||
-rw-r--r-- | apps/files/js/files.js | 6 |
4 files changed, 18 insertions, 15 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index 3879aa65888..03ebdccb32d 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -235,7 +235,7 @@ OC.Upload = { var file = data.files[0]; try { // FIXME: not so elegant... need to refactor that method to return a value - Files.isFileNameValid(file.name, FileList.getCurrentDirectory()); + Files.isFileNameValid(file.name); } catch (errorMessage) { data.textStatus = 'invalidcharacters'; @@ -555,8 +555,6 @@ OC.Upload = { throw t('files', 'URL cannot be empty'); } else if (type !== 'web' && !Files.isFileNameValid(filename)) { // Files.isFileNameValid(filename) throws an exception itself - } else if (FileList.getCurrentDirectory() === '/' && filename.toLowerCase() === 'shared') { - throw t('files', 'In the home folder \'Shared\' is a reserved filename'); } else if (FileList.inList(filename)) { throw t('files', '{new_name} already exists', {new_name: filename}); } else { diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 631aebea954..ecdfa72a477 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -118,10 +118,6 @@ var FileActions = { }; var addAction = function (name, action, displayName) { - // NOTE: Temporary fix to prevent rename action in root of Shared directory - if (name === 'Rename' && $('#dir').val() === '/Shared') { - return true; - } if ((name === 'Download' || action !== defaultAction) && name !== 'Delete') { @@ -160,7 +156,7 @@ var FileActions = { addAction(name, ah, displayName); } }); - if(actions.Share && !($('#dir').val() === '/' && file === 'Shared')){ + if(actions.Share){ displayName = t('files', 'Share'); addAction('Share', actions.Share, displayName); } @@ -223,7 +219,7 @@ $(document).ready(function () { $('#fileList tr').each(function () { FileActions.display($(this).children('td.filename')); }); - + $('#fileList').trigger(jQuery.Event("fileActionsReady")); }); diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index ab2601c5fb2..c33b638b5a6 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -178,6 +178,13 @@ window.FileList = { if (type === 'dir') { mime = mime || 'httpd/unix-directory'; } + + // user should always be able to rename a share mount point + var allowRename = 0; + if (fileData.isShareMountPoint) { + allowRename = OC.PERMISSION_UPDATE; + } + //containing tr var tr = $('<tr></tr>').attr({ "data-id" : fileData.id, @@ -187,7 +194,7 @@ window.FileList = { "data-mime": mime, "data-mtime": mtime, "data-etag": fileData.etag, - "data-permissions": fileData.permissions || this.getDirectoryPermissions() + "data-permissions": fileData.permissions | allowRename || this.getDirectoryPermissions() }); if (type === 'dir') { @@ -283,6 +290,10 @@ window.FileList = { mime = fileData.mimetype, permissions = parseInt(fileData.permissions, 10) || 0; + if (fileData.isShareMountPoint) { + permissions = permissions | OC.PERMISSION_UPDATE; + } + if (type === 'dir') { mime = mime || 'httpd/unix-directory'; } @@ -581,7 +592,7 @@ window.FileList = { var filename = input.val(); if (filename !== oldname) { // Files.isFileNameValid(filename) throws an exception itself - Files.isFileNameValid(filename, FileList.getCurrentDirectory()); + Files.isFileNameValid(filename); if (FileList.inList(filename)) { throw t('files', '{new_name} already exists', {new_name: filename}); } diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 9f38263bef3..5e669a796a9 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -87,11 +87,9 @@ var Files = { * Throws a string exception with an error message if * the file name is not valid */ - isFileNameValid: function (name, root) { + isFileNameValid: function (name) { var trimmedName = name.trim(); - if (trimmedName === '.' - || trimmedName === '..' - || (root === '/' && trimmedName.toLowerCase() === 'shared')) + if (trimmedName === '.' || trimmedName === '..') { throw t('files', '"{name}" is an invalid file name.', {name: name}); } else if (trimmedName.length === 0) { |