summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js/share.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-09-28 16:23:33 +0200
committerVincent Petry <pvince81@owncloud.com>2015-09-28 16:23:33 +0200
commitd47d240a357e3f7861b432b971a0ba96b31f20ca (patch)
treeaf7d1e55af357a5440c1106ef47da13618782210 /apps/files_sharing/js/share.js
parentd68079f93210f8fe0b5327e686497db97fde6a3e (diff)
downloadnextcloud-server-d47d240a357e3f7861b432b971a0ba96b31f20ca.tar.gz
nextcloud-server-d47d240a357e3f7861b432b971a0ba96b31f20ca.zip
Still show share link when recipient but no share permission
This makes it possible for the recipient to still trigger the sidebar and share tab to see information about the share. In the case where the file is not shared and no permissions exists, no action icon will be displayed.
Diffstat (limited to 'apps/files_sharing/js/share.js')
-rw-r--r--apps/files_sharing/js/share.js30
1 files changed, 10 insertions, 20 deletions
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index 66e4f9dc273..30a803f3207 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -103,11 +103,20 @@
name: 'Share',
displayName: '',
mime: 'all',
- permissions: OC.PERMISSION_SHARE,
+ permissions: OC.PERMISSION_ALL,
icon: OC.imagePath('core', 'actions/share'),
type: OCA.Files.FileActions.TYPE_INLINE,
actionHandler: function(fileName) {
fileList.showDetailsView(fileName, 'shareTabView');
+ },
+ render: function(actionSpec, isDefault, context) {
+ var permissions = parseInt(context.$file.attr('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);
+ }
+ // don't render anything
+ return null;
}
});
@@ -157,26 +166,7 @@
// if the statuses are loaded already, use them for the icon
// (needed when scrolling to the next page)
if (hasUserShares || hasLinkShare || $tr.attr('data-share-recipients') || $tr.attr('data-share-owner')) {
- var permissions = $tr.data('permissions');
OC.Share.markFileAsShared($tr, true, hasLinkShare);
- if ((permissions & OC.PERMISSION_SHARE) === 0 && $tr.attr('data-share-owner')) {
- // if no share action exists because the admin disabled sharing for this user
- // we create a share notification action to inform the user about files
- // shared with him otherwise we just update the existing share action.
- // TODO: make this work like/with OC.Share.markFileAsShared()
- $tr.find('.fileactions .action-share-notification').remove();
- var shareNotification = '<a class="action action-share-notification permanent"' +
- ' data-action="Share-Notification" href="#" original-title="">' +
- ' <img class="svg" src="' + OC.imagePath('core', 'actions/share') + '"></img>';
- $tr.find('.fileactions').append(function() {
- var shareBy = escapeHTML($tr.attr('data-share-owner'));
- var $result = $(shareNotification + '<span> ' + shareBy + '</span></span>');
- $result.on('click', function() {
- return false;
- });
- return $result;
- });
- }
return true;
}
return false;