[Pkg-owncloud-commits] [owncloud] 76/153: Correctly set expiration dates when adding additional shares

David Prévot taffit at moszumanska.debian.org
Tue May 27 03:05:39 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 d273b55e986488b9c24d0b2c27130221333d7ac9
Author: Joas Schilling <nickvergessen at gmx.de>
Date:   Wed May 7 12:17:46 2014 +0200

    Correctly set expiration dates when adding additional shares
---
 core/js/share.js | 35 +++++++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)

diff --git a/core/js/share.js b/core/js/share.js
index 6c6631a..f1d89ae 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -136,7 +136,21 @@ OC.Share={
 
 		return data;
 	},
-	share:function(itemType, itemSource, shareType, shareWith, permissions, itemSourceName, callback) {
+	share:function(itemType, itemSource, shareType, shareWith, permissions, itemSourceName, expirationDate, callback) {
+		// Add a fallback for old share() calls without expirationDate.
+		// We should remove this in a later version,
+		// after the Apps have been updated.
+		if (typeof callback === 'undefined' &&
+			typeof expirationDate === 'function') {
+			callback = expirationDate;
+			expirationDate = '';
+			console.warn(
+				"Call to 'OC.Share.share()' with too few arguments. " +
+				"'expirationDate' was assumed to be 'callback'. " +
+				"Please revisit the call and fix the list of arguments."
+			);
+		}
+
 		$.post(OC.filePath('core', 'ajax', 'share.php'),
 			{
 				action: 'share',
@@ -145,7 +159,8 @@ OC.Share={
 				shareType: shareType,
 				shareWith: shareWith,
 				permissions: permissions,
-				itemSourceName: itemSourceName
+				itemSourceName: itemSourceName,
+				expirationDate: expirationDate
 			}, function (result) {
 			if (result && result.status === 'success') {
 				if (callback) {
@@ -303,6 +318,10 @@ OC.Share={
 				var itemType = $('#dropdown').data('item-type');
 				var itemSource = $('#dropdown').data('item-source');
 				var itemSourceName = $('#dropdown').data('item-source-name');
+				var expirationDate = '';
+				if ( $('#expirationCheckbox').is(':checked') === true ) {
+					expirationDate = $( "#expirationDate" ).val();
+				}
 				var shareType = selected.item.value.shareType;
 				var shareWith = selected.item.value.shareWith;
 				$(this).val(shareWith);
@@ -322,7 +341,7 @@ OC.Share={
 					permissions = permissions | OC.PERMISSION_SHARE;
 				}
 
-				OC.Share.share(itemType, itemSource, shareType, shareWith, permissions, itemSourceName, function() {
+				OC.Share.share(itemType, itemSource, shareType, shareWith, permissions, itemSourceName, expirationDate, function() {
 					OC.Share.addShareWith(shareType, shareWith, selected.item.label, permissions, possiblePermissions);
 					$('#shareWith').val('');
 					OC.Share.updateIcon(itemType, itemSource);
@@ -643,6 +662,10 @@ $(document).ready(function() {
 		var itemType = $('#dropdown').data('item-type');
 		var itemSource = $('#dropdown').data('item-source');
 		var itemSourceName = $('#dropdown').data('item-source-name');
+		var expirationDate = '';
+		if ($('#expirationCheckbox').is(':checked') === true) {
+			expirationDate = $( "#expirationDate" ).val();
+		}
 		if (this.checked) {
 			// Create a link
 			if (oc_appconfig.core.enforcePasswordForPublicLink === false) {
@@ -682,6 +705,10 @@ $(document).ready(function() {
 		var itemType = $('#dropdown').data('item-type');
 		var itemSource = $('#dropdown').data('item-source');
 		var itemSourceName = $('#dropdown').data('item-source-name');
+		var expirationDate = '';
+		if ($('#expirationCheckbox').is(':checked') === true) {
+			expirationDate = $( "#expirationDate" ).val();
+		}
 		var permissions = 0;
 
 		// Calculate permissions
@@ -692,7 +719,7 @@ $(document).ready(function() {
 		}
 
 		// Update the share information
-		OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', permissions, itemSourceName, function(data) {
+		OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', permissions, itemSourceName, expirationDate, function(data) {
 		});
 	});
 

-- 
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