diff options
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/config.php | 4 | ||||
-rw-r--r-- | core/js/setupchecks.js | 10 | ||||
-rw-r--r-- | core/js/tests/specs/setupchecksSpec.js | 15 |
3 files changed, 22 insertions, 7 deletions
diff --git a/core/js/config.php b/core/js/config.php index 7216c50afa9..0670df60abd 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -2,12 +2,12 @@ /** * @author Bart Visscher <bartv@thisnet.nl> * @author Björn Schießle <schiessle@owncloud.com> + * @author Clark Tomlinson <fallen013@gmail.com> * @author Guillaume AMAT <guillaume.amat@informatique-libre.com> * @author Hasso Tepper <hasso@zone.ee> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Lukas Reschke <lukas@owncloud.com> - * @author Matthias Rieber <matthias@zu-con.org> * @author Morris Jobke <hey@morrisjobke.de> * @author Owen Winkler <a_github@midnightcircus.com> * @author Robin Appelman <icewind@owncloud.com> @@ -15,7 +15,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index f6485c4218c..2fa119334db 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -51,17 +51,23 @@ * * @param url the URL to test * @param placeholderUrl the placeholder URL - can be found at oc_defaults.docPlaceholderUrl + * @param {boolean} runCheck if this is set to false the check is skipped and no error is returned * @return $.Deferred object resolved with an array of error messages */ - checkWellKnownUrl: function(url, placeholderUrl) { + checkWellKnownUrl: function(url, placeholderUrl, runCheck) { var deferred = $.Deferred(); + + if(runCheck === false) { + deferred.resolve([]); + return deferred.promise(); + } var afterCall = function(xhr) { var messages = []; if (xhr.status !== 207) { var docUrl = placeholderUrl.replace('PLACEHOLDER', 'admin-setup-well-known-URL'); messages.push({ msg: t('core', 'Your web server is not set up properly to resolve "{url}". Further information can be found in our <a target="_blank" href="{docLink}">documentation</a>.', { docLink: docUrl, url: url }), - type: OC.SetupChecks.MESSAGE_TYPE_ERROR + type: OC.SetupChecks.MESSAGE_TYPE_INFO }); } deferred.resolve(messages); diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index d8d3d68b7a0..fff169ec098 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -62,21 +62,21 @@ describe('OC.SetupChecks tests', function() { describe('checkWellKnownUrl', function() { it('should fail with another response status code than 207', function(done) { - var async = OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav/', 'http://example.org/PLACEHOLDER'); + var async = OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav/', 'http://example.org/PLACEHOLDER', true); suite.server.requests[0].respond(200); async.done(function( data, s, x ){ expect(data).toEqual([{ msg: 'Your web server is not set up properly to resolve "/.well-known/caldav/". Further information can be found in our <a target="_blank" href="http://example.org/admin-setup-well-known-URL">documentation</a>.', - type: OC.SetupChecks.MESSAGE_TYPE_ERROR + type: OC.SetupChecks.MESSAGE_TYPE_INFO }]); done(); }); }); it('should return no error with a response status code of 207', function(done) { - var async = OC.SetupChecks.checkWebDAV('/.well-known/caldav/', 'http://example.org/PLACEHOLDER'); + var async = OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav/', 'http://example.org/PLACEHOLDER', true); suite.server.requests[0].respond(207); @@ -85,6 +85,15 @@ describe('OC.SetupChecks tests', function() { done(); }); }); + + it('should return no error when no check should be run', function(done) { + var async = OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav/', 'http://example.org/PLACEHOLDER', false); + + async.done(function( data, s, x ){ + expect(data).toEqual([]); + done(); + }); + }); }); describe('checkSetup', function() { |