Skip to content

Commit

Permalink
Remove small APIs deprecated in WordPress 5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Mar 30, 2021
1 parent adc0b38 commit 61571e8
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 76 deletions.
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 0 additions & 19 deletions packages/core-data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -649,25 +649,6 @@ _Returns_

- `boolean`: Whether there is a previous edit or not.

<a name="hasUploadPermissions" href="#hasUploadPermissions">#</a> **hasUploadPermissions**

> **Deprecated** since 5.0. Callers should use the more generic `canUser()` selector instead of `hasUploadPermissions()`, e.g. `canUser( 'create', 'media' )`.
Returns whether the current user can upload media.

Calling this may trigger an OPTIONS request to the REST API via the
`canUser()` resolver.

<https://developer.wordpress.org/rest-api/reference/>

_Parameters_

- _state_ `Object`: Data state.

_Returns_

- `boolean`: Whether or not the user can upload media. Defaults to `true` if the OPTIONS request is being made.

<a name="isAutosavingEntityRecord" href="#isAutosavingEntityRecord">#</a> **isAutosavingEntityRecord**

Returns true if the specified entity record is autosaving, and false otherwise.
Expand Down
1 change: 0 additions & 1 deletion packages/core-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"@wordpress/blocks": "file:../blocks",
"@wordpress/data": "file:../data",
"@wordpress/data-controls": "file:../data-controls",
"@wordpress/deprecated": "file:../deprecated",
"@wordpress/element": "file:../element",
"@wordpress/i18n": "file:../i18n",
"@wordpress/is-shallow-equal": "file:../is-shallow-equal",
Expand Down
15 changes: 0 additions & 15 deletions packages/core-data/src/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { find, includes, get, hasIn, compact, uniq } from 'lodash';
* WordPress dependencies
*/
import { addQueryArgs } from '@wordpress/url';
import deprecated from '@wordpress/deprecated';
import { controls } from '@wordpress/data';
import { apiFetch } from '@wordpress/data-controls';
/**
Expand Down Expand Up @@ -286,20 +285,6 @@ export function* getEmbedPreview( url ) {
}
}

/**
* Requests Upload Permissions from the REST API.
*
* @deprecated since 5.0. Callers should use the more generic `canUser()` selector instead of
* `hasUploadPermissions()`, e.g. `canUser( 'create', 'media' )`.
*/
export function* hasUploadPermissions() {
deprecated( "select( 'core' ).hasUploadPermissions()", {
since: '5.2',
alternative: "select( 'core' ).canUser( 'create', 'media' )",
} );
yield* canUser( 'create', 'media' );
}

/**
* Checks whether the current user can perform the given action on the given
* REST resource.
Expand Down
27 changes: 1 addition & 26 deletions packages/core-data/src/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
* External dependencies
*/
import createSelector from 'rememo';
import { set, map, find, get, filter, compact, defaultTo } from 'lodash';
import { set, map, find, get, filter, compact } from 'lodash';

/**
* WordPress dependencies
*/
import { createRegistrySelector } from '@wordpress/data';
import deprecated from '@wordpress/deprecated';
import { addQueryArgs } from '@wordpress/url';

/**
Expand Down Expand Up @@ -616,30 +615,6 @@ export function isPreviewEmbedFallback( state, url ) {
return preview.html === oEmbedLinkCheck;
}

/**
* Returns whether the current user can upload media.
*
* Calling this may trigger an OPTIONS request to the REST API via the
* `canUser()` resolver.
*
* https://developer.wordpress.org/rest-api/reference/
*
* @deprecated since 5.0. Callers should use the more generic `canUser()` selector instead of
* `hasUploadPermissions()`, e.g. `canUser( 'create', 'media' )`.
*
* @param {Object} state Data state.
*
* @return {boolean} Whether or not the user can upload media. Defaults to `true` if the OPTIONS
* request is being made.
*/
export function hasUploadPermissions( state ) {
deprecated( "select( 'core' ).hasUploadPermissions()", {
since: '5.2',
alternative: "select( 'core' ).canUser( 'create', 'media' )",
} );
return defaultTo( canUser( state, 'create', 'media' ), true );
}

/**
* Returns whether the current user can perform the given action on the given
* REST resource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
import { useShortcut } from '@wordpress/keyboard-shortcuts';
import { useDispatch } from '@wordpress/data';
import deprecated from '@wordpress/deprecated';
import { BlockEditorKeyboardShortcuts } from '@wordpress/block-editor';

/**
Expand Down Expand Up @@ -41,12 +40,3 @@ function VisualEditorGlobalKeyboardShortcuts() {
}

export default VisualEditorGlobalKeyboardShortcuts;

export function EditorGlobalKeyboardShortcuts() {
deprecated( 'EditorGlobalKeyboardShortcuts', {
since: '5.2',
alternative: 'VisualEditorGlobalKeyboardShortcuts',
} );

return <VisualEditorGlobalKeyboardShortcuts />;
}
5 changes: 1 addition & 4 deletions packages/editor/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ export * from './autocompleters';
export { default as AutosaveMonitor } from './autosave-monitor';
export { default as DocumentOutline } from './document-outline';
export { default as DocumentOutlineCheck } from './document-outline/check';
export {
default as VisualEditorGlobalKeyboardShortcuts,
EditorGlobalKeyboardShortcuts,
} from './global-keyboard-shortcuts/visual-editor-shortcuts';
export { default as VisualEditorGlobalKeyboardShortcuts } from './global-keyboard-shortcuts/visual-editor-shortcuts';
export { default as TextEditorGlobalKeyboardShortcuts } from './global-keyboard-shortcuts/text-editor-shortcuts';
export { default as EditorKeyboardShortcutsRegister } from './global-keyboard-shortcuts/register-shortcuts';
export { default as EditorHistoryRedo } from './editor-history/redo';
Expand Down

0 comments on commit 61571e8

Please sign in to comment.