Implement "notify by email" checkbox in share dialog
This commit is contained in:
parent
e0a2004f4c
commit
aeee19b3f2
|
@ -84,7 +84,8 @@
|
||||||
events: {
|
events: {
|
||||||
'click .unshare': 'onUnshare',
|
'click .unshare': 'onUnshare',
|
||||||
'click .permissions': 'onPermissionChange',
|
'click .permissions': 'onPermissionChange',
|
||||||
'click .showCruds': 'onCrudsToggle'
|
'click .showCruds': 'onCrudsToggle',
|
||||||
|
'click .mailNotification': 'onSendMailNotification'
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
|
@ -279,11 +280,19 @@
|
||||||
this.model.setPermissions(shareType, shareWith, permissions);
|
this.model.setPermissions(shareType, shareWith, permissions);
|
||||||
},
|
},
|
||||||
|
|
||||||
onCrudsToggle: function(event) {
|
onCrudsToggle: function() {
|
||||||
this.$el.find('.cruds').toggleClass('hidden');
|
this.$el.find('.cruds').toggleClass('hidden');
|
||||||
return false;
|
return false;
|
||||||
}
|
},
|
||||||
|
|
||||||
|
onSendMailNotification: function(event) {
|
||||||
|
var $target = $(event.target);
|
||||||
|
var $li = $(event.target).closest('li');
|
||||||
|
var shareType = $li.data('share-type');
|
||||||
|
var shareWith = $li.attr('data-share-with');
|
||||||
|
|
||||||
|
this.model.sendNotificationForShare(shareType, shareWith, $target.is(':checked'));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
OC.Share.ShareDialogShareeListView = ShareDialogShareeListView;
|
OC.Share.ShareDialogShareeListView = ShareDialogShareeListView;
|
||||||
|
|
|
@ -465,6 +465,34 @@
|
||||||
return share.share_mail_send === '1';
|
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}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue