Merge pull request #19455 from nextcloud/techdebt/deprecate-oc-router-helpers

Deprecate OC router helpers that are provided by packages
This commit is contained in:
Roeland Jago Douma 2020-02-13 20:30:17 +01:00 committed by GitHub
commit 584e729029
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 119 additions and 83 deletions

28
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

74
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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -23,6 +23,7 @@
* Get a variable by name * Get a variable by name
* @param {string} context context * @param {string} context context
* @returns {Function} getter * @returns {Function} getter
* @deprecated 19.0.0 use https://lodash.com/docs#get
*/ */
export const get = context => name => { export const get = context => name => {
const namespaces = name.split('.') const namespaces = name.split('.')
@ -41,6 +42,7 @@ export const get = context => name => {
* Set a variable by name * Set a variable by name
* @param {string} context context * @param {string} context context
* @returns {Function} setter * @returns {Function} setter
* @deprecated 19.0.0 use https://lodash.com/docs#set
*/ */
export const set = context => (name, value) => { export const set = context => (name, value) => {
const namespaces = name.split('.') const namespaces = name.split('.')

View File

@ -85,13 +85,16 @@ import L10N, {
} from './l10n' } from './l10n'
import { import {
filePath,
generateUrl, generateUrl,
getRootPath, generateFilePath,
generateOcsUrl,
generateRemoteUrl,
getRootUrl,
imagePath, imagePath,
linkTo, linkTo,
linkToOCS, } from '@nextcloud/router'
linkToRemote,
import {
linkToRemoteBase, linkToRemoteBase,
} from './routing' } from './routing'
import msg from './msg' import msg from './msg'
@ -146,7 +149,7 @@ export default {
* Currently logged in user or null if none * Currently logged in user or null if none
* *
* @type String * @type String
* @deprecated use {@link OC.getCurrentUser} instead * @deprecated use `getCurrentUser` from https://www.npmjs.com/package/@nextcloud/auth
*/ */
currentUser, currentUser,
dialogs: Dialogs, dialogs: Dialogs,
@ -156,6 +159,7 @@ export default {
* user (public page mode) * user (public page mode)
* *
* @since 9.0.0 * @since 9.0.0
* @deprecated 19.0.0 use `getCurrentUser` from https://www.npmjs.com/package/@nextcloud/auth
*/ */
getCurrentUser, getCurrentUser,
isUserAdmin, isUserAdmin,
@ -248,18 +252,45 @@ export default {
theme, theme,
Util, Util,
debug, debug,
filePath, /**
* @deprecated 19.0.0 use `generateFilePath` from https://www.npmjs.com/package/@nextcloud/router
*/
filePath: generateFilePath,
/**
* @deprecated 19.0.0 use `generateUrl` from https://www.npmjs.com/package/@nextcloud/router
*/
generateUrl, generateUrl,
/**
* @deprecated 19.0.0 use https://lodash.com/docs#get
*/
get: get(window), get: get(window),
/**
* @deprecated 19.0.0 use https://lodash.com/docs#set
*/
set: set(window), set: set(window),
getRootPath, /**
* @deprecated 19.0.0 use `getRootUrl` from https://www.npmjs.com/package/@nextcloud/router
*/
getRootPath: getRootUrl,
/**
* @deprecated 19.0.0 use `imagePath` from https://www.npmjs.com/package/@nextcloud/router
*/
imagePath, imagePath,
redirect, redirect,
reload, reload,
requestToken: getRequestToken(), requestToken: getRequestToken(),
/**
* @deprecated 19.0.0 use `linkTo` from https://www.npmjs.com/package/@nextcloud/router
*/
linkTo, linkTo,
linkToOCS, /**
linkToRemote, * @deprecated 19.0.0 use `generateOcsUrl` from https://www.npmjs.com/package/@nextcloud/router
*/
linkToOCS: generateOcsUrl,
/**
* @deprecated 19.0.0 use `generateRemoteUrl` from https://www.npmjs.com/package/@nextcloud/router
*/
linkToRemote: generateRemoteUrl,
linkToRemoteBase, linkToRemoteBase,
/** /**
* Relative path to Nextcloud root. * Relative path to Nextcloud root.
@ -267,7 +298,7 @@ export default {
* *
* @type string * @type string
* *
* @deprecated since 8.2, use OC.getRootPath() instead * @deprecated 19.0.0 use `getRootUrl` from https://www.npmjs.com/package/@nextcloud/router
* @see OC#getRootPath * @see OC#getRootPath
*/ */
webroot, webroot,

View File

@ -106,6 +106,7 @@ export const generateUrl = (url, params, options) => {
* @param {string} app the app id to which the image belongs * @param {string} app the app id to which the image belongs
* @param {string} file the name of the image file * @param {string} file the name of the image file
* @returns {string} * @returns {string}
* @deprecated 19.0.0 use `imagePath` from https://www.npmjs.com/package/@nextcloud/router
*/ */
export const imagePath = (app, file) => { export const imagePath = (app, file) => {
if (file.indexOf('.') === -1) { if (file.indexOf('.') === -1) {
@ -122,6 +123,7 @@ export const imagePath = (app, file) => {
* @param {string} type the type of the file to link to (e.g. css,img,ajax.template) * @param {string} type the type of the file to link to (e.g. css,img,ajax.template)
* @param {string} file the filename * @param {string} file the filename
* @returns {string} Absolute URL for a file in an app * @returns {string} Absolute URL for a file in an app
* @deprecated 19.0.0 use `generateFilePath` from https://www.npmjs.com/package/@nextcloud/router
*/ */
export const filePath = (app, type, file) => { export const filePath = (app, type, file) => {
const isCore = coreApps.indexOf(app) !== -1 const isCore = coreApps.indexOf(app) !== -1
@ -172,6 +174,7 @@ export const filePath = (app, type, file) => {
* *
* @returns {string} web root path * @returns {string} web root path
* *
* @deprecated 19.0.0 use `getRootUrl` from https://www.npmjs.com/package/@nextcloud/router
* @since 8.2 * @since 8.2
*/ */
export const getRootPath = () => OC.webroot export const getRootPath = () => OC.webroot