[Pkg-owncloud-commits] [owncloud] 136/153: fix share label creation

David Prévot taffit at moszumanska.debian.org
Tue May 27 03:05:46 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit ff4bb3a9e66c42c5bdea326a9cec6f3e1d768957
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date:   Fri May 23 16:21:15 2014 +0200

    fix share label creation
---
 apps/files_sharing/js/share.js | 49 ++++++++++++++++++++++--------------------
 1 file changed, 26 insertions(+), 23 deletions(-)

diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index e9889ba..893577d 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -30,31 +30,34 @@ $(document).ready(function() {
 			// 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;
 			var $fileList = $(this);
-			if (oc_appconfig.core.sharingDisabledForUser) {
-				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});
-					var $result = $(shareNotification + '<span> ' + shareBy + '</span></span>');
-					$result.on('click', function() {
-						return false;
+			$fileList.find('[data-share-owner]').each(function() {
+				var $tr = $(this);
+				var $action;
+				var owner;
+				var message;
+				var permissions = $tr.data('permissions');
+				if(permissions & OC.PERMISSION_SHARE) {
+					$action = $tr.find('[data-Action="Share"]');
+					$action.addClass('permanent');
+					owner = $tr.closest('tr').attr('data-share-owner');
+					message = ' ' + t('files_sharing', 'Shared by {owner}', {owner: owner});
+					$action.find('span').text(message);
+				} else {
+					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 owner = $(this).closest('tr').attr('data-share-owner');
+						var shareBy = t('files_sharing', 'Shared by {owner}', {owner: owner});
+						var $result = $(shareNotification + '<span> ' + shareBy + '</span></span>');
+						$result.on('click', function() {
+							return false;
+						});
+						return $result;
 					});
-					return $result;
-				});
-
-			} 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...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list