From d86c1e95030ebd613348f36d62984ecd842c2618 Mon Sep 17 00:00:00 2001 From: "John Molakvoæ (skjnldsv)" Date: Wed, 20 Jun 2018 20:32:19 +0200 Subject: Disable sidebar on deleted share MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- apps/files_sharing/js/share.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'apps/files_sharing/js/share.js') diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index 22513e1b470..5f7705a8369 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -42,6 +42,12 @@ var fileActions = fileList.fileActions; var oldCreateRow = fileList._createRow; fileList._createRow = function(fileData) { + + if (fileData.permissions === 0) { + // no permission, disabling sidebar + delete fileActions.actions.all.Details; + } + var tr = oldCreateRow.apply(this, arguments); var sharePermissions = OCA.Sharing.Util.getSharePermissions(fileData); tr.attr('data-share-permissions', sharePermissions); @@ -158,11 +164,15 @@ permissions: OC.PERMISSION_ALL, iconClass: 'icon-shared', type: OCA.Files.FileActions.TYPE_INLINE, - actionHandler: function(fileName) { - fileList.showDetailsView(fileName, 'shareTabView'); + actionHandler: function(fileName, context) { + // do not open sidebar if no permission on the file + var permissions = parseInt(context.$file.data('share-permissions'), 10); + if (permissions > 0) { + fileList.showDetailsView(fileName, 'shareTabView'); + } }, render: function(actionSpec, isDefault, context) { - var permissions = parseInt(context.$file.attr('data-permissions'), 10); + var permissions = parseInt(context.$file.data('permissions'), 10); // if no share permissions but share owner exists, still show the link if ((permissions & OC.PERMISSION_SHARE) !== 0 || context.$file.attr('data-share-owner')) { return fileActions._defaultRenderAction.call(fileActions, actionSpec, isDefault, context); -- cgit v1.2.3