summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js/share.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/js/share.js')
-rw-r--r--apps/files_sharing/js/share.js32
1 files changed, 24 insertions, 8 deletions
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index 7d68a8d8860..1b04097ccb1 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -27,13 +27,29 @@ $(document).ready(function() {
}
$('#fileList').on('fileActionsReady',function(){
- var $fileList = $(this);
- var allShared = $fileList.find('[data-share-owner] [data-Action="Share"]');
- allShared.addClass('permanent');
- allShared.find('span').text(function(){
- var $owner = $(this).closest('tr').attr('data-share-owner');
- return ' ' + t('files_sharing', 'Shared by {owner}', {owner: $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.
+ var allShared;
+ if (oc_appconfig.core.sharingDisabledForUser) {
+ var $fileList = $(this);
+ allShared = $fileList.find('[data-share-owner]');
+ 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>';
+ $(allShared).find('.fileactions').append(function() {
+ var owner = $(this).closest('tr').attr('data-share-owner');
+ var shareBy = t('files_sharing', 'Shared by {owner}', {owner: owner});
+ return shareNotification + '<span> ' + shareBy + '</span></span>';
+ });
+ } else {
+ allShared = $fileList.find('[data-share-owner] [data-Action="Share"]');
+ allShared.addClass('permanent');
+ allShared.find('span').text(function(){
+ var $owner = $(this).closest('tr').attr('data-share-owner');
+ return ' ' + t('files_sharing', 'Shared by {owner}', {owner: $owner});
+ });
+ }
// FIXME: these calls are also working on hard-coded
// list selectors...
@@ -48,7 +64,7 @@ $(document).ready(function() {
}
});
- FileActions.register('all', 'Share', OC.PERMISSION_READ, OC.imagePath('core', 'actions/share'), function(filename) {
+ FileActions.register('all', 'Share', OC.PERMISSION_SHARE, OC.imagePath('core', 'actions/share'), function(filename) {
var tr = FileList.findFileEl(filename);
var itemType = 'file';
if ($(tr).data('type') == 'dir') {