From 4ad922d4f6ea7f08c54223587964bb93ae064ce5 Mon Sep 17 00:00:00 2001 From: "John Molakvoæ (skjnldsv)" Date: Thu, 14 Mar 2019 18:01:44 +0100 Subject: Show sharing in menu in grid view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- apps/files_sharing/src/share.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'apps/files_sharing/src') diff --git a/apps/files_sharing/src/share.js b/apps/files_sharing/src/share.js index b02c6e3d9ee..f253dcb2db9 100644 --- a/apps/files_sharing/src/share.js +++ b/apps/files_sharing/src/share.js @@ -162,11 +162,33 @@ fileActions.registerAction({ name: 'Share', - displayName: '', + displayName: function(context) { + if (context && context.$file) { + var shareType = parseInt(context.$file.data('share-types'), 10) + var shareOwner = context.$file.data('share-owner-id') + if (shareType >= 0 || shareOwner) { + return t('core', 'Shared') + } + } + return t('core', 'Share') + }, altText: t('core', 'Share'), mime: 'all', + order: -60, permissions: OC.PERMISSION_ALL, - iconClass: 'icon-shared', + iconClass: function(fileName, context) { + var shareType = parseInt(context.$file.data('share-types'), 10) + if (shareType === OC.Share.SHARE_TYPE_EMAIL) { + return 'icon-public' + } + return 'icon-shared' + }, + icon: function(fileName, context) { + var shareOwner = context.$file.data('share-owner-id') + if (shareOwner) { + return OC.generateUrl(`/avatar/${shareOwner}/32`) + } + }, type: OCA.Files.FileActions.TYPE_INLINE, actionHandler: function(fileName, context) { // do not open sidebar if permission is set and equal to 0 -- cgit v1.2.3