diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/js/fileactions.js | 22 | ||||
-rw-r--r-- | apps/files_sharing/js/share.js | 8 |
2 files changed, 26 insertions, 4 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 3623663ed6c..8ce8eddb0b0 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -558,7 +558,27 @@ } }); - this._renderMenuTrigger($tr, context); + function objectValues(obj) { + var res = []; + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + res.push(obj[i]); + } + } + return res; + } + // polyfill + if (!Object.values) { + Object.values = objectValues; + } + + var menuActions = Object.values(this.actions.all).filter(function (action) { + return action.type !== OCA.Files.FileActions.TYPE_INLINE; + }); + // do not render the menu if nothing is in it + if (menuActions.length > 0) { + this._renderMenuTrigger($tr, context); + } if (triggerEvent){ fileList.$fileList.trigger(jQuery.Event("fileActionsReady", {fileList: fileList, $files: $tr})); diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index 0f8dc58a85e..68529fd882f 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -42,14 +42,16 @@ var fileActions = fileList.fileActions; var oldCreateRow = fileList._createRow; fileList._createRow = function(fileData) { + + var tr = oldCreateRow.apply(this, arguments); + var sharePermissions = OCA.Sharing.Util.getSharePermissions(fileData); if (fileData.permissions === 0) { // no permission, disabling sidebar + delete fileActions.actions.all.Comment; delete fileActions.actions.all.Details; + delete fileActions.actions.all.Goto; } - - var tr = oldCreateRow.apply(this, arguments); - var sharePermissions = OCA.Sharing.Util.getSharePermissions(fileData); tr.attr('data-share-permissions', sharePermissions); if (fileData.shareOwner) { tr.attr('data-share-owner', fileData.shareOwner); |