From f556c58c22405945263bc6debfa6a424e2c601cb Mon Sep 17 00:00:00 2001
From: Bjoern Schiessle
" + escapeHTML(item.email) + '' )
- .appendTo( ul );
- };
- }
- this.delegateEvents();
-
- return this;
- },
-
- /**
- * @returns {Function} from Handlebars
- * @private
- */
- template: function () {
- if (!this._template) {
- this._template = Handlebars.compile(TEMPLATE);
- }
- return this._template;
- }
-
- });
-
- OC.Share.ShareDialogMailView = ShareDialogMailView;
-
-})();
diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js
index 775eaa554b..f532d27c4b 100644
--- a/core/js/sharedialogshareelistview.js
+++ b/core/js/sharedialogshareelistview.js
@@ -173,7 +173,6 @@
hasCreatePermission: this.model.hasCreatePermission(shareIndex),
hasUpdatePermission: this.model.hasUpdatePermission(shareIndex),
hasDeletePermission: this.model.hasDeletePermission(shareIndex),
- wasMailSent: this.model.notificationMailWasSent(shareIndex),
shareWith: shareWith,
shareWithDisplayName: shareWithDisplayName,
shareWithTitle: shareWithTitle,
@@ -189,7 +188,6 @@
getShareeList: function() {
var universal = {
avatarEnabled: this.configModel.areAvatarsEnabled(),
- notifyByMailLabel: t('core', 'notify by email'),
unshareLabel: t('core', 'Unshare'),
canShareLabel: t('core', 'can reshare'),
canEditLabel: t('core', 'can edit'),
diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js
index 3b2a7480c4..b277a1226c 100644
--- a/core/js/sharedialogview.js
+++ b/core/js/sharedialogview.js
@@ -28,7 +28,6 @@
'' +
'' +
'' +
- '' +
'';
var TEMPLATE_REMOTE_SHARE_INFO =
@@ -70,9 +69,6 @@
/** @type {object} **/
shareeListView: undefined,
- /** @type {object} **/
- mailView: undefined,
-
events: {
'input .shareWithField': 'onShareWithFieldChanged'
},
@@ -109,8 +105,7 @@
resharerInfoView: 'ShareDialogResharerInfoView',
linkShareView: 'ShareDialogLinkShareView',
expirationView: 'ShareDialogExpirationView',
- shareeListView: 'ShareDialogShareeListView',
- mailView: 'ShareDialogMailView'
+ shareeListView: 'ShareDialogShareeListView'
};
for(var name in subViews) {
@@ -383,9 +378,6 @@
this.shareeListView.$el = this.$el.find('.shareeListView');
this.shareeListView.render();
- this.mailView.$el = this.$el.find('.mailView');
- this.mailView.render();
-
this.$el.find('.hasTooltip').tooltip();
return this;
diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js
index ecc75ab147..a784f59f67 100644
--- a/core/js/shareitemmodel.js
+++ b/core/js/shareitemmodel.js
@@ -417,49 +417,6 @@
return (share.permissions & permission) === permission;
},
- notificationMailWasSent: function(shareIndex) {
- /** @type OC.Share.Types.ShareInfo **/
- var share = this.get('shares')[shareIndex];
- if(!_.isObject(share)) {
- throw "Unknown Share";
- }
- return share.mail_send === 1;
- },
-
- /**
- * Send the link share information by email
- *
- * @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');
-
- $.post(
- OC.generateUrl('core/ajax/share.php'), {
- action: 'email',
- toaddress: recipientEmail,
- link: linkShare.link,
- itemType: itemType,
- itemSource: itemSource,
- file: this.fileInfoModel.get('name'),
- expiration: linkShare.expiration || ''
- },
- function(result) {
- 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();
- },
-
/**
* @returns {boolean}
*/
diff --git a/core/js/tests/specs/sharedialogshareelistview.js b/core/js/tests/specs/sharedialogshareelistview.js
index 699e2e58d7..bcc596a138 100644
--- a/core/js/tests/specs/sharedialogshareelistview.js
+++ b/core/js/tests/specs/sharedialogshareelistview.js
@@ -34,8 +34,6 @@ describe('OC.Share.ShareDialogShareeListView', function () {
oldAppConfig = _.extend({}, oc_appconfig.core);
oc_appconfig.core.enforcePasswordForPublicLink = false;
- $('#testArea').append('');
-
fileInfoModel = new OCA.Files.FileInfoModel({
id: 123,
name: 'shared_file_name.txt',
diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js
index f0e027d9fb..8acaf62e2e 100644
--- a/core/js/tests/specs/sharedialogviewSpec.js
+++ b/core/js/tests/specs/sharedialogviewSpec.js
@@ -247,7 +247,7 @@ describe('OC.Share.ShareDialogView', function() {
expect(slideToggleStub.callCount).toEqual(1);
expect(slideToggleStub.getCall(0).thisValue.eq(0).attr('id')).toEqual('linkPass');
expect(fakeServer.requests.length).toEqual(0);
-
+
// Now untoggle share by link
dialog.$el.find('.linkCheckbox').click();
dialog.render();
@@ -402,76 +402,7 @@ describe('OC.Share.ShareDialogView', function() {
expect($.datepicker._defaults.maxDate).toEqual(new Date(2014, 0, 27, 0, 0, 0, 0));
});
});
- describe('send link by email', function() {
- var sendEmailPrivateLinkStub;
- var clock;
- beforeEach(function() {
- configModel.set({
- isMailPublicNotificationEnabled: true
- });
-
- shareModel.set('linkShare', {
- isLinkShare: true,
- token: 'tehtoken',
- permissions: OC.PERMISSION_READ,
- expiration: null
- });
-
- sendEmailPrivateLinkStub = sinon.stub(dialog.model, "sendEmailPrivateLink");
- clock = sinon.useFakeTimers();
- });
- afterEach(function() {
- sendEmailPrivateLinkStub.restore();
- clock.restore();
- });
-
- it('displays form when sending emails is enabled', function() {
- $('input[name=mailPublicNotificationEnabled]').val('yes');
- dialog.render();
- expect(dialog.$('.emailPrivateLinkForm').length).toEqual(1);
- });
- it('form not rendered when sending emails is disabled', function() {
- $('input[name=mailPublicNotificationEnabled]').val('no');
- dialog.render();
- expect(dialog.$('.emailPrivateLinkForm').length).toEqual(0);
- });
- it('input cleared on success', function() {
- var defer = $.Deferred();
- sendEmailPrivateLinkStub.returns(defer.promise());
-
- $('input[name=mailPublicNotificationEnabled]').val('yes');
- dialog.render();
-
- dialog.$el.find('.emailPrivateLinkForm .emailField').val('a@b.c');
- dialog.$el.find('#emailButton').trigger('click');
-
- expect(sendEmailPrivateLinkStub.callCount).toEqual(1);
- expect(dialog.$el.find('.emailPrivateLinkForm .emailField').val()).toEqual('Sending ...');
-
- defer.resolve();
- expect(dialog.$el.find('.emailPrivateLinkForm .emailField').val()).toEqual('Email sent');
-
- clock.tick(2000);
- expect(dialog.$el.find('.emailPrivateLinkForm .emailField').val()).toEqual('');
- });
- it('input not cleared on failure', function() {
- var defer = $.Deferred();
- sendEmailPrivateLinkStub.returns(defer.promise());
-
- $('input[name=mailPublicNotificationEnabled]').val('yes');
- dialog.render();
-
- dialog.$el.find('.emailPrivateLinkForm .emailField').val('a@b.c');
- dialog.$el.find('#emailButton').trigger('click');
-
- expect(sendEmailPrivateLinkStub.callCount).toEqual(1);
- expect(dialog.$el.find('.emailPrivateLinkForm .emailField').val()).toEqual('Sending ...');
-
- defer.reject();
- expect(dialog.$el.find('.emailPrivateLinkForm .emailField').val()).toEqual('a@b.c');
- });
- });
});
describe('check for avatar', function() {
beforeEach(function() {
diff --git a/core/js/tests/specs/shareitemmodelSpec.js b/core/js/tests/specs/shareitemmodelSpec.js
index 9d9001dc9e..1cddcb2aca 100644
--- a/core/js/tests/specs/shareitemmodelSpec.js
+++ b/core/js/tests/specs/shareitemmodelSpec.js
@@ -464,107 +464,7 @@ describe('OC.Share.ShareItemModel', function() {
});
});
- describe('sendEmailPrivateLink', function() {
- it('succeeds', function() {
- /* jshint camelcase: false */
- fetchReshareDeferred.resolve(makeOcsResponse([]));
- fetchSharesDeferred.resolve(makeOcsResponse([{
- displayname_owner: 'root',
- expiration: null,
- file_source: 123,
- file_target: '/folder',
- id: 20,
- item_source: '123',
- item_type: 'folder',
- mail_send: '0',
- parent: null,
- path: '/folder',
- permissions: OC.PERMISSION_READ,
- share_type: OC.Share.SHARE_TYPE_LINK,
- share_with: null,
- stime: 1403884258,
- storage: 1,
- token: 'tehtoken',
- uid_owner: 'root'
- }]));
- OC.currentUser = 'root';
- model.fetch();
-
- var res = model.sendEmailPrivateLink('foo@bar.com');
-
- expect(res.state()).toEqual('pending');
- expect(fakeServer.requests.length).toEqual(1);
- expect(fakeServer.requests[0].url).toEqual(OC.generateUrl('core/ajax/share.php'));
- expect(OC.parseQueryString(fakeServer.requests[0].requestBody)).toEqual(
- {
- action: 'email',
- toaddress: 'foo@bar.com',
- link: model.get('linkShare').link,
- itemType: 'file',
- itemSource: '123',
- file: 'shared_file_name.txt',
- expiration: ''
- }
- )
-
- fakeServer.requests[0].respond(
- 200,
- { 'Content-Type': 'application/json' },
- JSON.stringify({status: 'success'})
- );
- expect(res.state()).toEqual('resolved');
- });
-
- it('fails', function() {
- /* jshint camelcase: false */
- fetchReshareDeferred.resolve(makeOcsResponse([]));
- fetchSharesDeferred.resolve(makeOcsResponse([{
- displayname_owner: 'root',
- expiration: null,
- file_source: 123,
- file_target: '/folder',
- id: 20,
- item_source: '123',
- item_type: 'folder',
- mail_send: '0',
- parent: null,
- path: '/folder',
- permissions: OC.PERMISSION_READ,
- share_type: OC.Share.SHARE_TYPE_LINK,
- share_with: null,
- stime: 1403884258,
- storage: 1,
- token: 'tehtoken',
- uid_owner: 'root'
- }]));
- OC.currentUser = 'root';
- model.fetch();
-
- var res = model.sendEmailPrivateLink('foo@bar.com');
-
- expect(res.state()).toEqual('pending');
- expect(fakeServer.requests.length).toEqual(1);
- expect(fakeServer.requests[0].url).toEqual(OC.generateUrl('core/ajax/share.php'));
- expect(OC.parseQueryString(fakeServer.requests[0].requestBody)).toEqual(
- {
- action: 'email',
- toaddress: 'foo@bar.com',
- link: model.get('linkShare').link,
- itemType: 'file',
- itemSource: '123',
- file: 'shared_file_name.txt',
- expiration: ''
- }
- )
-
- fakeServer.requests[0].respond(
- 200,
- { 'Content-Type': 'application/json' },
- JSON.stringify({data: {message: 'fail'}, status: 'error'})
- );
- expect(res.state()).toEqual('rejected');
- });
- });
+
describe('share permissions', function() {
beforeEach(function() {
oc_appconfig.core.resharingAllowed = true;
@@ -635,7 +535,7 @@ describe('OC.Share.ShareItemModel', function() {
addShareStub = sinon.stub(model, 'addShare');
updateShareStub = sinon.stub(model, 'updateShare');
});
- afterEach(function() {
+ afterEach(function() {
addShareStub.restore();
updateShareStub.restore();
});
diff --git a/lib/private/Settings/Admin/Sharing.php b/lib/private/Settings/Admin/Sharing.php
index 5982104460..9b17efa802 100644
--- a/lib/private/Settings/Admin/Sharing.php
+++ b/lib/private/Settings/Admin/Sharing.php
@@ -52,8 +52,6 @@ class Sharing implements ISettings {
// Built-In Sharing
'allowGroupSharing' => $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes'),
'allowLinks' => $this->config->getAppValue('core', 'shareapi_allow_links', 'yes'),
- 'allowMailNotification' => $this->config->getAppValue('core', 'shareapi_allow_mail_notification', 'no'),
- 'allowPublicMailNotification' => $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no'),
'allowPublicUpload' => $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes'),
'allowResharing' => $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes'),
'allowShareDialogUserEnumeration' => $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes'),
diff --git a/settings/templates/admin/sharing.php b/settings/templates/admin/sharing.php
index eed8f36dbd..db025c8f20 100644
--- a/settings/templates/admin/sharing.php
+++ b/settings/templates/admin/sharing.php
@@ -80,11 +80,6 @@
value="1" />
- />
-
-
/> diff --git a/tests/lib/Settings/Admin/SharingTest.php b/tests/lib/Settings/Admin/SharingTest.php index d0cda5308f..122bf2b6ca 100644 --- a/tests/lib/Settings/Admin/SharingTest.php +++ b/tests/lib/Settings/Admin/SharingTest.php @@ -62,55 +62,45 @@ class SharingTest extends TestCase { $this->config ->expects($this->at(3)) ->method('getAppValue') - ->with('core', 'shareapi_allow_mail_notification', 'no') - ->willReturn('no'); - $this->config - ->expects($this->at(4)) - ->method('getAppValue') - ->with('core', 'shareapi_allow_public_notification', 'no') - ->willReturn('no'); - $this->config - ->expects($this->at(5)) - ->method('getAppValue') ->with('core', 'shareapi_allow_public_upload', 'yes') ->willReturn('yes'); $this->config - ->expects($this->at(6)) + ->expects($this->at(4)) ->method('getAppValue') ->with('core', 'shareapi_allow_resharing', 'yes') ->willReturn('yes'); $this->config - ->expects($this->at(7)) + ->expects($this->at(5)) ->method('getAppValue') ->with('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') ->willReturn('yes'); $this->config - ->expects($this->at(8)) + ->expects($this->at(6)) ->method('getAppValue') ->with('core', 'shareapi_enabled', 'yes') ->willReturn('yes'); $this->config - ->expects($this->at(9)) + ->expects($this->at(7)) ->method('getAppValue') ->with('core', 'shareapi_default_expire_date', 'no') ->willReturn('no'); $this->config - ->expects($this->at(10)) + ->expects($this->at(8)) ->method('getAppValue') ->with('core', 'shareapi_expire_after_n_days', '7') ->willReturn('7'); $this->config - ->expects($this->at(11)) + ->expects($this->at(9)) ->method('getAppValue') ->with('core', 'shareapi_enforce_expire_date', 'no') ->willReturn('no'); $this->config - ->expects($this->at(12)) + ->expects($this->at(10)) ->method('getAppValue') ->with('core', 'shareapi_exclude_groups', 'no') ->willReturn('no'); $this->config - ->expects($this->at(13)) + ->expects($this->at(11)) ->method('getAppValue') ->with('core', 'shareapi_public_link_disclaimertext', null) ->willReturn('Lorem ipsum'); @@ -121,8 +111,6 @@ class SharingTest extends TestCase { [ 'allowGroupSharing' => 'yes', 'allowLinks' => 'yes', - 'allowMailNotification' => 'no', - 'allowPublicMailNotification' => 'no', 'allowPublicUpload' => 'yes', 'allowResharing' => 'yes', 'allowShareDialogUserEnumeration' => 'yes', @@ -161,55 +149,45 @@ class SharingTest extends TestCase { $this->config ->expects($this->at(3)) ->method('getAppValue') - ->with('core', 'shareapi_allow_mail_notification', 'no') - ->willReturn('no'); - $this->config - ->expects($this->at(4)) - ->method('getAppValue') - ->with('core', 'shareapi_allow_public_notification', 'no') - ->willReturn('no'); - $this->config - ->expects($this->at(5)) - ->method('getAppValue') ->with('core', 'shareapi_allow_public_upload', 'yes') ->willReturn('yes'); $this->config - ->expects($this->at(6)) + ->expects($this->at(4)) ->method('getAppValue') ->with('core', 'shareapi_allow_resharing', 'yes') ->willReturn('yes'); $this->config - ->expects($this->at(7)) + ->expects($this->at(5)) ->method('getAppValue') ->with('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') ->willReturn('yes'); $this->config - ->expects($this->at(8)) + ->expects($this->at(6)) ->method('getAppValue') ->with('core', 'shareapi_enabled', 'yes') ->willReturn('yes'); $this->config - ->expects($this->at(9)) + ->expects($this->at(7)) ->method('getAppValue') ->with('core', 'shareapi_default_expire_date', 'no') ->willReturn('no'); $this->config - ->expects($this->at(10)) + ->expects($this->at(8)) ->method('getAppValue') ->with('core', 'shareapi_expire_after_n_days', '7') ->willReturn('7'); $this->config - ->expects($this->at(11)) + ->expects($this->at(9)) ->method('getAppValue') ->with('core', 'shareapi_enforce_expire_date', 'no') ->willReturn('no'); $this->config - ->expects($this->at(12)) + ->expects($this->at(10)) ->method('getAppValue') ->with('core', 'shareapi_exclude_groups', 'no') ->willReturn('yes'); $this->config - ->expects($this->at(13)) + ->expects($this->at(11)) ->method('getAppValue') ->with('core', 'shareapi_public_link_disclaimertext', null) ->willReturn('Lorem ipsum'); @@ -220,8 +198,6 @@ class SharingTest extends TestCase { [ 'allowGroupSharing' => 'yes', 'allowLinks' => 'yes', - 'allowMailNotification' => 'no', - 'allowPublicMailNotification' => 'no', 'allowPublicUpload' => 'yes', 'allowResharing' => 'yes', 'allowShareDialogUserEnumeration' => 'yes',