From aeee19b3f24eb60252ba55b89be745027ed39faf Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 14 Sep 2015 18:03:44 +0200 Subject: Implement "notify by email" checkbox in share dialog --- core/js/shareitemmodel.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'core/js/shareitemmodel.js') diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js index 877b3cb230d..595670faaef 100644 --- a/core/js/shareitemmodel.js +++ b/core/js/shareitemmodel.js @@ -465,6 +465,34 @@ return share.share_mail_send === '1'; }, + /** + * Sends an email notification for the given share + * + * @param {int} shareType share type + * @param {string} shareWith recipient + * @param {bool} state whether to set the notification flag or remove it + */ + sendNotificationForShare: function(shareType, shareWith, state) { + var itemType = this.get('itemType'); + var itemSource = this.get('itemSource'); + + $.post( + OC.generateUrl('core/ajax/share.php'), + { + action: state ? 'informRecipients' : 'informRecipientsDisabled', + recipient: shareWith, + shareType: shareType, + itemSource: itemSource, + itemType: itemType + }, + function(result) { + if (result.status !== 'success') { + OC.dialogs.alert(t('core', result.data.message), t('core', 'Warning')); + } + } + ); + }, + /** * @returns {boolean} */ -- cgit v1.2.3