summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
Diffstat (limited to 'core/js')
-rw-r--r--core/js/setupchecks.js6
-rw-r--r--core/js/sharedialogexpirationview.js7
-rw-r--r--core/js/sharedialoglinkshareview.js6
-rw-r--r--core/js/tests/specs/setupchecksSpec.js46
-rw-r--r--core/js/tests/specs/sharedialogviewSpec.js50
5 files changed, 99 insertions, 16 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js
index 2e21c6ad725..6e2058d54fc 100644
--- a/core/js/setupchecks.js
+++ b/core/js/setupchecks.js
@@ -98,6 +98,12 @@
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
});
}
+ if(!data.isCorrectMemcachedPHPModuleInstalled) {
+ messages.push({
+ msg: t('core', 'Memcached is configured as distributed cache, but the wrong PHP module "memcache" is installed. \\OC\\Memcache\\Memcached only supports "memcached" and not "memcache". See the <a href="{wikiLink}">memcached wiki about both modules</a>.', {wikiLink: 'https://code.google.com/p/memcached/wiki/PHPClientComparison'}),
+ type: OC.SetupChecks.MESSAGE_TYPE_WARNING
+ });
+ }
} else {
messages.push({
msg: t('core', 'Error occurred while checking server setup'),
diff --git a/core/js/sharedialogexpirationview.js b/core/js/sharedialogexpirationview.js
index fab48f5e6bc..772b9ba97dc 100644
--- a/core/js/sharedialogexpirationview.js
+++ b/core/js/sharedialogexpirationview.js
@@ -132,6 +132,11 @@
var isExpirationSet = !!this.model.get('linkShare').expiration || isExpirationEnforced;
+ var expiration;
+ if (isExpirationSet) {
+ expiration = moment(this.model.get('linkShare').expiration, 'YYYY-MM-DD').format('DD-MM-YYYY')
+ }
+
var expirationTemplate = this.template();
this.$el.html(expirationTemplate({
setExpirationLabel: t('core', 'Set expiration date'),
@@ -142,7 +147,7 @@
isExpirationSet: isExpirationSet,
isExpirationEnforced: isExpirationEnforced,
disableCheckbox: isExpirationEnforced && isExpirationSet,
- expirationValue: this.model.get('linkShare').expiration
+ expirationValue: expiration
}));
// what if there is another date picker on that page?
diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js
index 3d8fb461461..792062f0e16 100644
--- a/core/js/sharedialoglinkshareview.js
+++ b/core/js/sharedialoglinkshareview.js
@@ -124,7 +124,11 @@
this.$el.find('#linkPassText').focus();
}
} else {
- this.model.removeLinkShare();
+ if (this.model.get('linkShare').isLinkShare) {
+ this.model.removeLinkShare();
+ } else {
+ this.$el.find('#linkPass').slideToggle(OC.menuSpeed);
+ }
}
},
diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js
index c70ea0ff9fa..8dd2214621a 100644
--- a/core/js/tests/specs/setupchecksSpec.js
+++ b/core/js/tests/specs/setupchecksSpec.js
@@ -73,7 +73,8 @@ describe('OC.SetupChecks tests', function() {
isUrandomAvailable: true,
serverHasInternetConnection: false,
memcacheDocs: 'https://doc.owncloud.org/server/go.php?to=admin-performance',
- forwardedForHeadersWorking: true
+ forwardedForHeadersWorking: true,
+ isCorrectMemcachedPHPModuleInstalled: true,
})
);
@@ -106,7 +107,8 @@ describe('OC.SetupChecks tests', function() {
serverHasInternetConnection: false,
dataDirectoryProtected: false,
memcacheDocs: 'https://doc.owncloud.org/server/go.php?to=admin-performance',
- forwardedForHeadersWorking: true
+ forwardedForHeadersWorking: true,
+ isCorrectMemcachedPHPModuleInstalled: true,
})
);
@@ -141,7 +143,8 @@ describe('OC.SetupChecks tests', function() {
serverHasInternetConnection: false,
dataDirectoryProtected: false,
isMemcacheConfigured: true,
- forwardedForHeadersWorking: true
+ forwardedForHeadersWorking: true,
+ isCorrectMemcachedPHPModuleInstalled: true,
})
);
@@ -173,7 +176,8 @@ describe('OC.SetupChecks tests', function() {
serverHasInternetConnection: true,
dataDirectoryProtected: true,
isMemcacheConfigured: true,
- forwardedForHeadersWorking: true
+ forwardedForHeadersWorking: true,
+ isCorrectMemcachedPHPModuleInstalled: true,
})
);
@@ -186,6 +190,34 @@ describe('OC.SetupChecks tests', function() {
});
});
+ it('should return an error if the wrong memcache PHP module is installed', function(done) {
+ var async = OC.SetupChecks.checkSetup();
+
+ suite.server.requests[0].respond(
+ 200,
+ {
+ 'Content-Type': 'application/json',
+ },
+ JSON.stringify({
+ isUrandomAvailable: true,
+ securityDocs: 'https://docs.owncloud.org/myDocs.html',
+ serverHasInternetConnection: true,
+ dataDirectoryProtected: true,
+ isMemcacheConfigured: true,
+ forwardedForHeadersWorking: true,
+ isCorrectMemcachedPHPModuleInstalled: false,
+ })
+ );
+
+ async.done(function( data, s, x ){
+ expect(data).toEqual([{
+ msg: 'Memcached is configured as distributed cache, but the wrong PHP module "memcache" is installed. \\OC\\Memcache\\Memcached only supports "memcached" and not "memcache". See the <a href="https://code.google.com/p/memcached/wiki/PHPClientComparison">memcached wiki about both modules</a>.',
+ type: OC.SetupChecks.MESSAGE_TYPE_WARNING
+ }]);
+ done();
+ });
+ });
+
it('should return an error if the forwarded for headers are not working', function(done) {
var async = OC.SetupChecks.checkSetup();
@@ -200,7 +232,8 @@ describe('OC.SetupChecks tests', function() {
dataDirectoryProtected: true,
isMemcacheConfigured: true,
forwardedForHeadersWorking: false,
- reverseProxyDocs: 'https://docs.owncloud.org/foo/bar.html'
+ reverseProxyDocs: 'https://docs.owncloud.org/foo/bar.html',
+ isCorrectMemcachedPHPModuleInstalled: true,
})
);
@@ -248,7 +281,8 @@ describe('OC.SetupChecks tests', function() {
dataDirectoryProtected: true,
isMemcacheConfigured: true,
forwardedForHeadersWorking: true,
- phpSupported: {eol: true, version: '5.4.0'}
+ phpSupported: {eol: true, version: '5.4.0'},
+ isCorrectMemcachedPHPModuleInstalled: true,
})
);
diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js
index de6f9944094..22ae63e796a 100644
--- a/core/js/tests/specs/sharedialogviewSpec.js
+++ b/core/js/tests/specs/sharedialogviewSpec.js
@@ -231,6 +231,43 @@ describe('OC.Share.ShareDialogView', function() {
expect(dialog.$el.find('#linkCheckbox').prop('checked')).toEqual(true);
expect(dialog.$el.find('#linkText').val()).toEqual(link);
});
+ describe('password', function() {
+ var slideToggleStub;
+
+ beforeEach(function() {
+ $('#allowShareWithLink').val('yes');
+ configModel.set({
+ enforcePasswordForPublicLink: false
+ });
+
+ slideToggleStub = sinon.stub($.fn, 'slideToggle');
+ });
+ afterEach(function() {
+ slideToggleStub.restore();
+ });
+
+ it('enforced but toggled does not fire request', function() {
+ configModel.set('enforcePasswordForPublicLink', true);
+ dialog.render();
+
+ dialog.$el.find('[name=linkCheckbox]').click();
+
+ // The password linkPass field is shown (slideToggle is called).
+ // No request is made yet
+ 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('[name=linkCheckbox]').click();
+ dialog.render();
+
+ // Password field disappears and no ajax requests have been made
+ expect(fakeServer.requests.length).toEqual(0);
+ expect(slideToggleStub.callCount).toEqual(2);
+ expect(slideToggleStub.getCall(1).thisValue.eq(0).attr('id')).toEqual('linkPass');
+ });
+ });
describe('expiration date', function() {
var shareData;
var shareItem;
@@ -274,10 +311,10 @@ describe('OC.Share.ShareDialogView', function() {
expect(dialog.$el.find('#expirationDate').val()).toEqual('');
});
it('checks expiration date checkbox and populates field when expiration date was set', function() {
- shareModel.get('linkShare').expiration = 1234;
+ shareModel.get('linkShare').expiration = '2014-02-01 00:00:00';
dialog.render();
expect(dialog.$el.find('[name=expirationCheckbox]').prop('checked')).toEqual(true);
- expect(dialog.$el.find('#expirationDate').val()).toEqual('1234');
+ expect(dialog.$el.find('#expirationDate').val()).toEqual('01-02-2014');
});
it('sets default date when default date setting is enabled', function() {
configModel.set('isDefaultExpireDateEnabled', true);
@@ -289,8 +326,7 @@ describe('OC.Share.ShareDialogView', function() {
// enabled by default
expect(dialog.$el.find('[name=expirationCheckbox]').prop('checked')).toEqual(true);
- // TODO: those zeros must go...
- expect(dialog.$el.find('#expirationDate').val()).toEqual('2014-1-27 00:00:00');
+ expect(dialog.$el.find('#expirationDate').val()).toEqual('27-01-2014');
// disabling is allowed
dialog.$el.find('[name=expirationCheckbox]').click();
@@ -308,8 +344,7 @@ describe('OC.Share.ShareDialogView', function() {
dialog.render();
expect(dialog.$el.find('[name=expirationCheckbox]').prop('checked')).toEqual(true);
- // TODO: those zeros must go...
- expect(dialog.$el.find('#expirationDate').val()).toEqual('2014-1-27 00:00:00');
+ expect(dialog.$el.find('#expirationDate').val()).toEqual('27-01-2014');
// disabling is not allowed
expect(dialog.$el.find('[name=expirationCheckbox]').prop('disabled')).toEqual(true);
@@ -338,8 +373,7 @@ describe('OC.Share.ShareDialogView', function() {
);
expect(dialog.$el.find('[name=expirationCheckbox]').prop('checked')).toEqual(true);
- // TODO: those zeros must go...
- expect(dialog.$el.find('#expirationDate').val()).toEqual('2014-1-27 00:00:00');
+ expect(dialog.$el.find('#expirationDate').val()).toEqual('27-01-2014');
// disabling is not allowed
expect(dialog.$el.find('[name=expirationCheckbox]').prop('disabled')).toEqual(true);