summaryrefslogtreecommitdiffstats
path: root/core/src/globals.js
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2019-05-10 14:18:08 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2019-05-13 08:27:43 +0200
commitc624c102a6edbe51256aaf5c0025ff6331018f32 (patch)
tree224082375cd3a6c433d6f3481e548e99ed8a47a6 /core/src/globals.js
parent0b136d28a3ab9a14f1a001c0bc8ca15d4a4abf4a (diff)
downloadnextcloud-server-c624c102a6edbe51256aaf5c0025ff6331018f32.tar.gz
nextcloud-server-c624c102a6edbe51256aaf5c0025ff6331018f32.zip
Move OC.requestToken to the bundle, deprecate oc_requesttoken
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/src/globals.js')
-rw-r--r--core/src/globals.js23
1 files changed, 13 insertions, 10 deletions
diff --git a/core/src/globals.js b/core/src/globals.js
index 65ad3148ec6..48955f11d3a 100644
--- a/core/src/globals.js
+++ b/core/src/globals.js
@@ -42,7 +42,7 @@ const deprecate = (func, funcName) => {
return newFunc
}
-const setDeprecatedProp = (global, val, msg) => {
+const setDeprecatedProp = (global, cb, msg) => {
if (window[global] !== undefined) {
delete window[global]
}
@@ -53,7 +53,8 @@ const setDeprecatedProp = (global, val, msg) => {
} else {
warnIfNotTesting(`${global} is deprecated`)
}
- return val
+
+ return cb()
}
})
}
@@ -93,6 +94,7 @@ import OCP from './OCP/index'
import OCA from './OCA/index'
import escapeHTML from './Util/escapeHTML'
import formatDate from './Util/format-date'
+import {getToken as getRequestToken} from './OC/requesttoken'
import getURLParameter from './Util/get-url-parameter'
import humanFileSize from './Util/human-file-size'
import relative_modified_date from './Util/relative-modified-date'
@@ -115,14 +117,15 @@ window['md5'] = md5
window['moment'] = moment
window['OC'] = OC
-setDeprecatedProp('initCore', initCore, 'this is an internal function')
-setDeprecatedProp('oc_appswebroots', OC.appswebroots, 'use OC.appswebroots instead')
-setDeprecatedProp('oc_config', OC.config, 'use OC.config instead')
-setDeprecatedProp('oc_current_user', OC.getCurrentUser().uid, 'use OC.getCurrentUser().uid instead')
-setDeprecatedProp('oc_debug', OC.debug, 'use OC.debug instead')
-setDeprecatedProp('oc_isadmin', OC.isUserAdmin(), 'use OC.isUserAdmin() instead')
-setDeprecatedProp('oc_webroot', OC.webroot, 'use OC.getRootPath() instead')
-setDeprecatedProp('OCDialogs', OC.dialogs, 'use OC.dialogs instead')
+setDeprecatedProp('initCore', () => initCore, 'this is an internal function')
+setDeprecatedProp('oc_appswebroots', () => OC.appswebroots, 'use OC.appswebroots instead')
+setDeprecatedProp('oc_config', () => OC.config, 'use OC.config instead')
+setDeprecatedProp('oc_current_user', () => OC.getCurrentUser().uid, 'use OC.getCurrentUser().uid instead')
+setDeprecatedProp('oc_debug', () => OC.debug, 'use OC.debug instead')
+setDeprecatedProp('oc_isadmin', OC.isUserAdmin, 'use OC.isUserAdmin() instead')
+setDeprecatedProp('oc_requesttoken', () => getRequestToken(), 'use OC.requestToken instead')
+setDeprecatedProp('oc_webroot', () => OC.webroot, 'use OC.getRootPath() instead')
+setDeprecatedProp('OCDialogs', () => OC.dialogs, 'use OC.dialogs instead')
window['OCP'] = OCP
window['OCA'] = OCA
window['escapeHTML'] = deprecate(escapeHTML, 'escapeHTML')