[Pkg-owncloud-commits] [owncloud] 08/129: Fix share email sending feedback

David Prévot taffit at moszumanska.debian.org
Thu Nov 5 01:04:17 UTC 2015


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

taffit pushed a commit to branch stable8
in repository owncloud.

commit b0abb583c9be94e5eca3da8e39b5d861c2a471a5
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Wed Oct 7 17:50:51 2015 +0200

    Fix share email sending feedback
    
    Redisplay email address after failure
---
 core/js/sharedialoglinkshareview.js | 10 ++++++++--
 core/js/shareitemmodel.js           |  8 +++++++-
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js
index 792062f..1bbd10d 100644
--- a/core/js/sharedialoglinkshareview.js
+++ b/core/js/sharedialoglinkshareview.js
@@ -194,13 +194,19 @@
 				$emailField.prop('disabled', true);
 				$emailButton.prop('disabled', true);
 				$emailField.val(t('core', 'Sending ...'));
-				this.model.sendEmailPrivateLink(email).then(function() {
+				this.model.sendEmailPrivateLink(email).done(function() {
 					$emailField.css('font-weight', 'bold').val(t('core','Email sent'));
 					setTimeout(function() {
-						$emailField.css('font-weight', 'normal').val('');
+						$emailField.val('');
+						$emailField.css('font-weight', 'normal');
 						$emailField.prop('disabled', false);
 						$emailButton.prop('disabled', false);
 					}, 2000);
+				}).fail(function() {
+					$emailField.val(email);
+					$emailField.css('font-weight', 'normal');
+					$emailField.prop('disabled', false);
+					$emailButton.prop('disabled', false);
 				});
 			}
 			return false;
diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js
index 328d291..1cf116f 100644
--- a/core/js/shareitemmodel.js
+++ b/core/js/shareitemmodel.js
@@ -522,11 +522,12 @@
 		 * @param {string} recipientEmail recipient email address
 		 */
 		sendEmailPrivateLink: function(recipientEmail) {
+			var deferred = $.Deferred();
 			var itemType = this.get('itemType');
 			var itemSource = this.get('itemSource');
 			var linkShare = this.get('linkShare');
 
-			return $.post(
+			$.post(
 				OC.generateUrl('core/ajax/share.php'), {
 					action: 'email',
 					toaddress: recipientEmail,
@@ -540,8 +541,13 @@
 					if (!result || result.status !== 'success') {
 						// FIXME: a model should not show dialogs
 						OC.dialogs.alert(result.data.message, t('core', 'Error while sending notification'));
+						deferred.reject();
+					} else {
+						deferred.resolve();
 					}
 			});
+
+			return deferred.promise();
 		},
 
 		/**

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