Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.org Plans: Use site.domain instead of slugToUrl helper #9338

Merged
merged 1 commit into from
Nov 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 0 additions & 9 deletions client/lib/url/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,6 @@ function urlToSlug( url ) {
return withoutHttp( url ).replace( /\//g, '::' );
}

function slugToUrl( slug ) {
if ( ! slug ) {
return null;
}

return slug.replace( /::/g, '/' );
}

export default {
isOutsideCalypso,
isExternal,
Expand All @@ -108,7 +100,6 @@ export default {
addSchemeIfMissing,
setUrlScheme,
urlToSlug,
slugToUrl,
// [TODO]: Move lib/route/add-query-args contents here
addQueryArgs
};
18 changes: 0 additions & 18 deletions client/lib/url/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
addSchemeIfMissing,
setUrlScheme,
urlToSlug,
slugToUrl,
} from '../';

describe( 'withoutHttp', () => {
Expand Down Expand Up @@ -238,20 +237,3 @@ describe( 'urlToSlug()', () => {
expect( urlWithoutHttp ).to.equal( 'example.com::example::test123' );
} );
} );

describe( 'slugToUrl()', () => {
it( 'should return null if slug is not provided', () => {
expect( slugToUrl() ).to.be.null;
} );

it( 'should return null if slug is empty string', () => {
expect( slugToUrl( '' ) ).to.be.null;
} );

it( 'should return null convert double colons to forward slashes', () => {
const slug = 'example.com::example::test123';
const expected = 'example.com/example/test123';

expect( slugToUrl( slug ) ).to.equal( expected );
} );
} );
5 changes: 2 additions & 3 deletions client/me/purchases/remove-purchase/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import purchasePaths from '../paths';
import { removePurchase } from 'state/purchases/actions';
import FormSectionHeading from 'components/forms/form-section-heading';
import userFactory from 'lib/user';
import { slugToUrl } from 'lib/url';
import { isOperatorsAvailable } from 'state/ui/olark/selectors';
import olarkActions from 'lib/olark-store/actions';

Expand Down Expand Up @@ -138,7 +137,7 @@ const RemovePurchase = React.createClass( {
notices.success(
this.translate( '%(productName)s was removed from {{siteName/}}.', {
args: { productName },
components: { siteName: <em>{ slugToUrl( selectedSite.slug ) }</em> }
components: { siteName: <em>{ selectedSite.domain }</em> }
} ),
{ persistent: true }
);
Expand Down Expand Up @@ -312,7 +311,7 @@ const RemovePurchase = React.createClass( {
'Are you sure you want to remove %(productName)s from {{siteName/}}?',
{
args: { productName },
components: { siteName: <em>{ slugToUrl( this.props.selectedSite.slug ) }</em> }
components: { siteName: <em>{ this.props.selectedSite.domain }</em> }
}
)
}
Expand Down