Move OC.getCapabilities to the bundle and deprecate OC._capabilities, oc_capabilities

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2019-05-13 21:29:40 +02:00
parent 5ee6872c8a
commit 6b46d9f2e5
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
15 changed files with 99 additions and 74 deletions

10
core/js/dist/login.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

80
core/js/dist/main.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,12 +6,6 @@ var OCP = Object.assign({}, window.OCP);
*/ */
Object.assign(window.OC, { Object.assign(window.OC, {
/* jshint camelcase: false */ /* jshint camelcase: false */
/**
* Capabilities
*
* @type array
*/
_capabilities: window.oc_capabilities || null,
theme: window.oc_defaults || {}, theme: window.oc_defaults || {},
@ -70,17 +64,6 @@ Object.assign(window.OC, {
return window.location.port; return window.location.port;
}, },
/**
* Returns the capabilities
*
* @return {array} capabilities
*
* @since 14.0
*/
getCapabilities: function() {
return OC._capabilities;
},
/** /**
* Loads translations for the given app asynchronously. * Loads translations for the given app asynchronously.
* *

View File

@ -598,8 +598,8 @@
var minPasswordLength = 4 var minPasswordLength = 4
// password policy? // password policy?
if(oc_capabilities.password_policy && oc_capabilities.password_policy.minLength) { if(OC.getCapabilities().password_policy && OC.getCapabilities().password_policy.minLength) {
minPasswordLength = oc_capabilities.password_policy.minLength; minPasswordLength = OC.getCapabilities().password_policy.minLength;
} }
var popoverBase = { var popoverBase = {

View File

@ -0,0 +1,31 @@
/*
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const capabilities = window._oc_capabilities || {}
/**
* Returns the capabilities
*
* @return {Array} capabilities
*
* @since 14.0
*/
export const getCapabilities = () => capabilities

View File

@ -49,6 +49,7 @@ import {currentUser, getCurrentUser} from './currentuser'
import Dialogs from './dialogs' import Dialogs from './dialogs'
import EventSource from './eventsource' import EventSource from './eventsource'
import {get, set} from './get_set' import {get, set} from './get_set'
import {getCapabilities} from './capabilities'
import { import {
getToken as getRequestToken, getToken as getRequestToken,
subscribe as subscribeToRequestTokenChange, subscribe as subscribeToRequestTokenChange,
@ -130,6 +131,15 @@ export default {
isUserAdmin, isUserAdmin,
L10N, L10N,
/**
* Capabilities
*
* @type {Array}
* @deprecated 17.0.0 use OC.getCapabilities() instead
*/
_capabilities: getCapabilities(),
getCapabilities,
/* /*
* Legacy menu helpers * Legacy menu helpers
*/ */

View File

@ -119,6 +119,7 @@ window['moment'] = moment
window['OC'] = OC window['OC'] = OC
setDeprecatedProp('initCore', () => initCore, 'this is an internal function') setDeprecatedProp('initCore', () => initCore, 'this is an internal function')
setDeprecatedProp('oc_appswebroots', () => OC.appswebroots, 'use OC.appswebroots instead') setDeprecatedProp('oc_appswebroots', () => OC.appswebroots, 'use OC.appswebroots instead')
setDeprecatedProp('oc_capabilities', OC.getCapabilities, 'use OC.getCapabilities instead')
setDeprecatedProp('oc_config', () => OC.config, 'use OC.config instead') setDeprecatedProp('oc_config', () => OC.config, 'use OC.config instead')
setDeprecatedProp('oc_current_user', () => OC.getCurrentUser().uid, 'use OC.getCurrentUser().uid instead') setDeprecatedProp('oc_current_user', () => OC.getCurrentUser().uid, 'use OC.getCurrentUser().uid instead')
setDeprecatedProp('oc_debug', () => OC.debug, 'use OC.debug instead') setDeprecatedProp('oc_debug', () => OC.debug, 'use OC.debug instead')

View File

@ -271,7 +271,7 @@ class JSConfigHelper {
'longFooter' => $this->defaults->getLongFooter(), 'longFooter' => $this->defaults->getLongFooter(),
'folder' => \OC_Util::getTheme(), 'folder' => \OC_Util::getTheme(),
]), ]),
"oc_capabilities" => json_encode($capabilities), "_oc_capabilities" => json_encode($capabilities),
]; ];
if ($this->currentUser !== null) { if ($this->currentUser !== null) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -279,9 +279,9 @@ const actions = {
getPasswordPolicyMinLength(context) { getPasswordPolicyMinLength(context) {
if(oc_capabilities.password_policy && oc_capabilities.password_policy.minLength) { if(OC.getCapabilities().password_policy && OC.getCapabilities().password_policy.minLength) {
context.commit('setPasswordPolicyMinLength', oc_capabilities.password_policy.minLength); context.commit('setPasswordPolicyMinLength', OC.getCapabilities().password_policy.minLength);
return oc_capabilities.password_policy.minLength; return OC.getCapabilities().password_policy.minLength;
} }
return false; return false;
}, },