Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Editor: remove the unexported getWPAdminURL and update internal refer…
…ences to use addQueryArgs
  • Loading branch information
gwwar committed Feb 23, 2022
commit b3846a7b89b6edbb5ac9fd7fab565637a4342a4c
4 changes: 2 additions & 2 deletions packages/editor/src/components/post-last-revision/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import { sprintf, _n } from '@wordpress/i18n';
import { Button } from '@wordpress/components';
import { withSelect } from '@wordpress/data';
import { backup } from '@wordpress/icons';
import { addQueryArgs } from '@wordpress/url';

/**
* Internal dependencies
*/
import PostLastRevisionCheck from './check';
import { getWPAdminURL } from '../../utils/url';
import { store as editorStore } from '../../store';

function LastRevision( { lastRevisionId, revisionsCount } ) {
return (
<PostLastRevisionCheck>
<Button
href={ getWPAdminURL( 'revision.php', {
href={ addQueryArgs( 'revision.php', {
revision: lastRevisionId,
gutenberg: true,
} ) }
Expand Down
3 changes: 1 addition & 2 deletions packages/editor/src/components/post-locked-modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { store as coreStore } from '@wordpress/core-data';
/**
* Internal dependencies
*/
import { getWPAdminURL } from '../../utils/url';
import { store as editorStore } from '../../store';

export default function PostLockedModal() {
Expand Down Expand Up @@ -164,7 +163,7 @@ export default function PostLockedModal() {
action: 'edit',
_wpnonce: postLockUtils.nonce,
} );
const allPostsUrl = getWPAdminURL( 'edit.php', {
const allPostsUrl = addQueryArgs( 'edit.php', {
post_type: get( postType, [ 'slug' ] ),
} );
const allPostsLabel = __( 'Exit editor' );
Expand Down
16 changes: 1 addition & 15 deletions packages/editor/src/utils/url.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
/**
* WordPress dependencies
*/
import { addQueryArgs, cleanForSlug as urlCleanForSlug } from '@wordpress/url';
import { cleanForSlug as urlCleanForSlug } from '@wordpress/url';
import deprecated from '@wordpress/deprecated';

/**
* Returns the URL of a WPAdmin Page.
*
* TODO: This should be moved to a module less specific to the editor.
*
* @param {string} page Page to navigate to.
* @param {Object} query Query Args.
*
* @return {string} WPAdmin URL.
*/
export function getWPAdminURL( page, query ) {
return addQueryArgs( page, query );
}

/**
* Performs some basic cleanup of a string for use as a post slug
*
Expand Down