Skip to content

Commit

Permalink
Limit opening posthog.com links in side panel to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Twixes committed Dec 5, 2023
1 parent 6e413b7 commit bd7b40c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frontend/src/lib/lemon-ui/Link/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ const isPostHogDomain = (url: string): boolean => {
return /^https:\/\/((www|app|eu)\.)?posthog\.com/.test(url)
}

const isPostHogComDomain = (url: string): boolean => {
return /^https:\/\/(www\.)?posthog\.com/.test(url)
const isPostHogComDocs = (url: string): boolean => {
return /^https:\/\/(www\.)?posthog\.com\/docs/.test(url)
}

/**
Expand Down Expand Up @@ -103,7 +103,7 @@ export const Link: React.FC<LinkProps & React.RefAttributes<HTMLElement>> = Reac
return
}

if (typeof to === 'string' && is3000 && isPostHogComDomain(to)) {
if (typeof to === 'string' && is3000 && isPostHogComDocs(to)) {
event.preventDefault()
openDocsPage(to)
return
Expand Down

0 comments on commit bd7b40c

Please sign in to comment.