Skip to content

Commit

Permalink
Framework: Drop deprecations slated for 2.8 removal (#6559)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth authored May 3, 2018
1 parent 8c7376e commit 98859d5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 112 deletions.
61 changes: 0 additions & 61 deletions components/autocomplete/completer-compat.js

This file was deleted.

34 changes: 2 additions & 32 deletions components/autocomplete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { __, _n, sprintf } from '@wordpress/i18n';
* Internal dependencies
*/
import './style.scss';
import { isDeprecatedCompleter, toCompatibleCompleter } from './completer-compat';
import withFocusOutside from '../higher-order/with-focus-outside';
import Button from '../button';
import Popover from '../popover';
Expand Down Expand Up @@ -207,36 +206,6 @@ export class Autocomplete extends Component {
};
}

/*
* NOTE: This is necessary for backwards compatibility with the
* previous completer interface. Once we no longer support the
* old interface, we should be able to use the `completers` prop
* directly.
*/
static getDerivedStateFromProps( nextProps, prevState ) {
const { completers: nextCompleters } = nextProps;
const { lastAppliedCompleters } = prevState;

if ( nextCompleters !== lastAppliedCompleters ) {
let completers = nextCompleters;

if ( completers.some( isDeprecatedCompleter ) ) {
completers = completers.map( ( completer ) => {
return isDeprecatedCompleter( completer ) ?
toCompatibleCompleter( completer ) :
completer;
} );
}

return {
completers,
lastAppliedCompleters: nextCompleters,
};
}

return null;
}

constructor() {
super( ...arguments );

Expand Down Expand Up @@ -466,7 +435,8 @@ export class Autocomplete extends Component {
}

search( event ) {
const { completers, open: wasOpen, suppress: wasSuppress, query: wasQuery } = this.state;
const { completers } = this.props;
const { open: wasOpen, suppress: wasSuppress, query: wasQuery } = this.state;
const container = event.target;

// ensure that the cursor location is unambiguous
Expand Down
19 changes: 0 additions & 19 deletions editor/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { serialize, getBlockType, getBlockTypes } from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';
import { addQueryArgs } from '@wordpress/url';
import { moment } from '@wordpress/date';
import { deprecated } from '@wordpress/utils';

/***
* Module constants
Expand Down Expand Up @@ -1294,15 +1293,6 @@ function buildInserterItemFromSharedBlock( state, allowedBlockTypes, sharedBlock
* @return {Editor.InserterItem[]} Items that appear in inserter.
*/
export function getInserterItems( state, allowedBlockTypes ) {
if ( allowedBlockTypes === undefined ) {
allowedBlockTypes = true;
deprecated( 'getInserterItems with no allowedBlockTypes argument', {
version: '2.8',
alternative: 'getInserterItems with an explcit allowedBlockTypes argument',
plugin: 'Gutenberg',
} );
}

if ( ! allowedBlockTypes ) {
return [];
}
Expand Down Expand Up @@ -1364,15 +1354,6 @@ function getItemsFromInserts( state, inserts, allowedBlockTypes, maximum = MAX_R
* @return {Editor.InserterItem[]} Items that appear in the 'Recent' tab.
*/
export function getFrecentInserterItems( state, allowedBlockTypes, maximum = MAX_RECENT_BLOCKS ) {
if ( allowedBlockTypes === undefined ) {
allowedBlockTypes = true;
deprecated( 'getFrecentInserterItems with no allowedBlockTypes argument', {
version: '2.8',
alternative: 'getFrecentInserterItems with an explcit allowedBlockTypes argument',
plugin: 'Gutenberg',
} );
}

const calculateFrecency = ( time, count ) => {
if ( ! time ) {
return count;
Expand Down

0 comments on commit 98859d5

Please sign in to comment.