chore: Fix link generation logic in help-center (#5470)
This commit is contained in:
parent
2d871a1ed5
commit
cc4ef14faa
8 changed files with 43 additions and 4 deletions
|
@ -4,7 +4,12 @@ export const buildPortalURL = portalSlug => {
|
|||
return `${baseURL}/hc/${portalSlug}`;
|
||||
};
|
||||
|
||||
export const buildPortalArticleURL = (portalSlug, categorySlug, articleId) => {
|
||||
export const buildPortalArticleURL = (
|
||||
portalSlug,
|
||||
categorySlug,
|
||||
locale,
|
||||
articleId
|
||||
) => {
|
||||
const portalURL = buildPortalURL(portalSlug);
|
||||
return `${portalURL}/${categorySlug}/${articleId}`;
|
||||
return `${portalURL}/${locale}/${categorySlug}/${articleId}`;
|
||||
};
|
||||
|
|
29
app/javascript/dashboard/helper/specs/portalHelper.spec.js
Normal file
29
app/javascript/dashboard/helper/specs/portalHelper.spec.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
import { buildPortalArticleURL, buildPortalURL } from '../portalHelper';
|
||||
|
||||
describe('PortalHelper', () => {
|
||||
describe('buildPortalURL', () => {
|
||||
it('returns the correct url', () => {
|
||||
window.chatwootConfig = {
|
||||
hostURL: 'https://app.chatwoot.com',
|
||||
helpCenterURL: 'https://help.chatwoot.com',
|
||||
};
|
||||
expect(buildPortalURL('handbook')).toEqual(
|
||||
'https://help.chatwoot.com/hc/handbook'
|
||||
);
|
||||
window.chatwootConfig = {};
|
||||
});
|
||||
});
|
||||
|
||||
describe('buildPortalArticleURL', () => {
|
||||
it('returns the correct url', () => {
|
||||
window.chatwootConfig = {
|
||||
hostURL: 'https://app.chatwoot.com',
|
||||
helpCenterURL: 'https://help.chatwoot.com',
|
||||
};
|
||||
expect(buildPortalArticleURL('handbook', 'culture', 'fr', 1)).toEqual(
|
||||
'https://help.chatwoot.com/hc/handbook/fr/culture/1'
|
||||
);
|
||||
window.chatwootConfig = {};
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue