Change oc_config usage to OC.config

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2019-05-02 08:28:24 +02:00
parent 579588a4cd
commit e7a190179f
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
7 changed files with 26 additions and 27 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -141,7 +141,7 @@ Object.assign(window.OC, {
} }
if(oc_config.modRewriteWorking == true) { if(OC.config.modRewriteWorking == true) {
return OC.getRootPath() + _build(url, params); return OC.getRootPath() + _build(url, params);
} }
@ -203,7 +203,7 @@ Object.assign(window.OC, {
* @param {string} file to check * @param {string} file to check
*/ */
fileIsBlacklisted: function(file) { fileIsBlacklisted: function(file) {
return !!(file.match(oc_config.blacklist_files_regex)); return !!(file.match(OC.config.blacklist_files_regex));
}, },
/** /**
@ -935,8 +935,8 @@ function initCore() {
function initSessionHeartBeat() { function initSessionHeartBeat() {
// interval in seconds // interval in seconds
var interval = NaN; var interval = NaN;
if (oc_config.session_lifetime) { if (OC.config.session_lifetime) {
interval = Math.floor(oc_config.session_lifetime / 2); interval = Math.floor(OC.config.session_lifetime / 2);
} }
interval = isNaN(interval)? 900: interval; interval = isNaN(interval)? 900: interval;
@ -957,8 +957,8 @@ function initCore() {
} }
// session heartbeat (defaults to enabled) // session heartbeat (defaults to enabled)
if (typeof(oc_config.session_keepalive) === 'undefined' || if (typeof(OC.config.session_keepalive) === 'undefined' ||
!!oc_config.session_keepalive) { !!OC.config.session_keepalive) {
initSessionHeartBeat(); initSessionHeartBeat();
} }

View File

@ -8,7 +8,7 @@
* *
*/ */
/* global moment, oc_appconfig, oc_config */ /* global moment, oc_appconfig */
(function() { (function() {
if (!OC.Share) { if (!OC.Share) {

View File

@ -361,8 +361,8 @@
} }
var moreResultsAvailable = var moreResultsAvailable =
( (
oc_config['sharing.maxAutocompleteResults'] > 0 OC.config['sharing.maxAutocompleteResults'] > 0
&& Math.min(perPage, oc_config['sharing.maxAutocompleteResults']) && Math.min(perPage, OC.config['sharing.maxAutocompleteResults'])
<= Math.max( <= Math.max(
users.length + exactUsers.length, users.length + exactUsers.length,
groups.length + exactGroups.length, groups.length + exactGroups.length,
@ -624,8 +624,8 @@
} }
var moreResultsAvailable = var moreResultsAvailable =
( (
oc_config['sharing.maxAutocompleteResults'] > 0 OC.config['sharing.maxAutocompleteResults'] > 0
&& Math.min(perPage, oc_config['sharing.maxAutocompleteResults']) && Math.min(perPage, OC.config['sharing.maxAutocompleteResults'])
<= Math.max( <= Math.max(
users.length + exactUsers.length, users.length + exactUsers.length,
groups.length + exactGroups.length, groups.length + exactGroups.length,
@ -690,7 +690,7 @@
$loading = this.$el.find('.shareWithLoading'), $loading = this.$el.find('.shareWithLoading'),
$confirm = this.$el.find('.shareWithConfirm'); $confirm = this.$el.find('.shareWithConfirm');
var count = oc_config['sharing.minSearchStringLength']; var count = OC.config['sharing.minSearchStringLength'];
if (search.term.trim().length < count) { if (search.term.trim().length < count) {
var title = n('core', var title = n('core',
'At least {count} character is needed for autocompletion', 'At least {count} character is needed for autocompletion',
@ -719,7 +719,7 @@
$shareWithField.removeClass('error') $shareWithField.removeClass('error')
.tooltip('hide'); .tooltip('hide');
var perPage = parseInt(oc_config['sharing.maxAutocompleteResults'], 10) || 200; var perPage = parseInt(OC.config['sharing.maxAutocompleteResults'], 10) || 200;
this._getSuggestions( this._getSuggestions(
search.term.trim(), search.term.trim(),
perPage, perPage,
@ -972,7 +972,7 @@
$shareWithField.focus(); $shareWithField.focus();
}; };
var perPage = parseInt(oc_config['sharing.maxAutocompleteResults'], 10) || 200; var perPage = parseInt(OC.config['sharing.maxAutocompleteResults'], 10) || 200;
this._getSuggestions( this._getSuggestions(
$shareWithField.val(), $shareWithField.val(),
perPage, perPage,

View File

@ -373,7 +373,7 @@ describe('Core base tests', function() {
beforeEach(function() { beforeEach(function() {
clock = sinon.useFakeTimers(); clock = sinon.useFakeTimers();
oldConfig = window.oc_config; oldConfig = OC.config;
routeStub = sinon.stub(OC, 'generateUrl').returns('/csrftoken'); routeStub = sinon.stub(OC, 'generateUrl').returns('/csrftoken');
counter = 0; counter = 0;
@ -388,14 +388,14 @@ describe('Core base tests', function() {
afterEach(function() { afterEach(function() {
clock.restore(); clock.restore();
/* jshint camelcase: false */ /* jshint camelcase: false */
window.oc_config = oldConfig; OC.config = oldConfig;
routeStub.restore(); routeStub.restore();
$(document).off('ajaxError'); $(document).off('ajaxError');
$(document).off('ajaxComplete'); $(document).off('ajaxComplete');
}); });
it('sends heartbeat half the session lifetime when heartbeat enabled', function() { it('sends heartbeat half the session lifetime when heartbeat enabled', function() {
/* jshint camelcase: false */ /* jshint camelcase: false */
window.oc_config = { OC.config = {
session_keepalive: true, session_keepalive: true,
session_lifetime: 300 session_lifetime: 300
}; };
@ -422,7 +422,7 @@ describe('Core base tests', function() {
}); });
it('does not send heartbeat when heartbeat disabled', function() { it('does not send heartbeat when heartbeat disabled', function() {
/* jshint camelcase: false */ /* jshint camelcase: false */
window.oc_config = { OC.config = {
session_keepalive: false, session_keepalive: false,
session_lifetime: 300 session_lifetime: 300
}; };
@ -439,7 +439,7 @@ describe('Core base tests', function() {
it('limits the heartbeat between one minute and one day', function() { it('limits the heartbeat between one minute and one day', function() {
/* jshint camelcase: false */ /* jshint camelcase: false */
var setIntervalStub = sinon.stub(window, 'setInterval'); var setIntervalStub = sinon.stub(window, 'setInterval');
window.oc_config = { OC.config = {
session_keepalive: true, session_keepalive: true,
session_lifetime: 5 session_lifetime: 5
}; };
@ -447,7 +447,7 @@ describe('Core base tests', function() {
expect(setIntervalStub.getCall(0).args[1]).toEqual(60 * 1000); expect(setIntervalStub.getCall(0).args[1]).toEqual(60 * 1000);
setIntervalStub.reset(); setIntervalStub.reset();
window.oc_config = { OC.config = {
session_keepalive: true, session_keepalive: true,
session_lifetime: 48 * 3600 session_lifetime: 48 * 3600
}; };

View File

@ -41,9 +41,8 @@ describe('OC.Share.ShareDialogView', function() {
// horrible parameters // horrible parameters
$('#testArea').append('<input id="allowShareWithLink" type="hidden" value="yes">'); $('#testArea').append('<input id="allowShareWithLink" type="hidden" value="yes">');
$container = $('#shareContainer'); $container = $('#shareContainer');
oldConfig = window.oc_config; oldConfig = OC.config;
window.oc_config = window.oc_config || {}; OC.config['sharing.maxAutocompleteResults'] = 0;
window.oc_config['sharing.maxAutocompleteResults'] = 0;
/* jshint camelcase:false */ /* jshint camelcase:false */
oldAppConfig = _.extend({}, oc_appconfig.core); oldAppConfig = _.extend({}, oc_appconfig.core);
oc_appconfig.core.enforcePasswordForPublicLink = false; oc_appconfig.core.enforcePasswordForPublicLink = false;
@ -112,7 +111,7 @@ describe('OC.Share.ShareDialogView', function() {
}); });
afterEach(function() { afterEach(function() {
OC.currentUser = oldCurrentUser; OC.currentUser = oldCurrentUser;
window.oc_config = oldConfig; OC.config = oldConfig;
/* jshint camelcase:false */ /* jshint camelcase:false */
oc_appconfig.core = oldAppConfig; oc_appconfig.core = oldAppConfig;
@ -620,7 +619,7 @@ describe('OC.Share.ShareDialogView', function() {
}); });
it('capped mixed matches', function() { it('capped mixed matches', function() {
window.oc_config['sharing.maxAutocompleteResults'] = 3; OC.config['sharing.maxAutocompleteResults'] = 3;
var doneStub = sinon.stub(); var doneStub = sinon.stub();
var failStub = sinon.stub(); var failStub = sinon.stub();