feat(mobile): add slug suffix to inbox report deep links#2432
Open
Gilbert09 wants to merge 2 commits into
Open
feat(mobile): add slug suffix to inbox report deep links#2432Gilbert09 wants to merge 2 commits into
Gilbert09 wants to merge 2 commits into
Conversation
Port of the desktop change in #2298: when the mobile "Discuss this report" flow builds a link back to the report, append the slugified title as a trailing path segment so shared/copied links read like `posthog://inbox/<reportId>/fix-inbox--Add-foo` instead of just the UUID. The slug is purely cosmetic; receivers ignore everything past the UUID. - Add `slugifyTitle` and `inboxReportShareUrl` to `lib/deep-links.ts`, mirroring `buildInboxDeeplink` from `apps/code/src/shared/deeplink.ts` (NFD fold, colon-run `--`, URL-unreserved punctuation passthrough, etc). - Thread `reportTitle` through `DiscussReportSheet` so the link it hands to `buildDiscussReportPrompt` is the slug-suffixed share URL. - Tolerate inbound `/inbox/<id>/<slug>` two ways: convert the route to a catch-all (`inbox/[...id].tsx`) so expo-router matches the deeper path, and strip the trailing slug in `externalUrlToAppPath` so notification-tap navigation lands on the bare `/inbox/<id>` path. - Unit tests cover the slug rules (accented-fold, colon-run, punctuation collapse, trim) and the inbound-path tolerance on both the custom-scheme and universal-link entry points. Generated-By: PostHog Code Task-Id: a37e6f21-3453-4ac4-9853-d61de0ea362a
Contributor
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
apps/mobile/src/lib/deep-links.test.ts:9-15
Several `it()` blocks exercise multiple independent inputs with separate `expect()` calls. The team's style guide prefers parameterised tests (`it.each`) so each input/expected pair gets its own test name and failure line when it breaks. The same pattern appears in `slugifyTitle` ("returns an empty string…" — 5 cases), `inboxReportShareUrl` ("returns just the UUID…" — 4 cases, "omits the slug…" — 2 cases), and `externalUrlToAppPath` ("ignores URLs…" — 2 cases).
```suggestion
it.each([
[null],
[undefined],
[""],
[" "],
[":::"],
])("returns an empty string when the title is %s", (input) => {
expect(slugifyTitle(input)).toBe("");
});
```
Reviews (1): Last reviewed commit: "feat(mobile): add slug suffix to inbox r..." | Re-trigger Greptile |
Address Greptile review feedback on #2432 — convert multi-expect blocks in `apps/mobile/src/lib/deep-links.test.ts` to `it.each` so each input/expected pair has its own test name and failure line. Generated-By: PostHog Code Task-Id: a37e6f21-3453-4ac4-9853-d61de0ea362a
k11kirky
approved these changes
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Port of the desktop PR #2298 to the mobile app: when the "Discuss this report" flow builds a link back to a report, append the slugified title as a trailing path segment so shared/copied links read like
posthog://inbox/<reportId>/fix-inbox--Add-fooinstead of just the UUID. The slug is purely cosmetic — receivers ignore everything past the UUID.apps/mobile/src/lib/deep-links.tsslugifyTitle(title)mirroringbuildInboxDeeplink's slug rules inapps/code/src/shared/deeplink.tsexactly (NFD-fold accented Latin, preserve URL-unreserved punctuation_ . ~, collapse colon-with-other-chars runs to--, single colon-only runs to-, strip leading/trailing hyphens).inboxReportShareUrl(reportId, title?)that produces the slug-suffixedposthog://inbox/<id>/<slug>custom-scheme URL (no slug when the title is empty / slugifies to empty).externalUrlToAppPathto strip a trailing slug from inbox custom-scheme and universal-link URLs so notification-tap navigation lands on the bare/inbox/<id>path. Mirrors the desktop receiver, which also ignores the slug.apps/mobile/src/app/inbox/[id].tsx→apps/mobile/src/app/inbox/[...id].tsx/inbox/<id>and/inbox/<id>/<slug>to the same report screen (the OS-level deep-link entry doesn't go throughexternalUrlToAppPath, so route-level tolerance is the load-bearing fix).reportIdfrom the first catch-all segment and passesreport.titleintoDiscussReportSheet._layout.tsxStack.Screen registration updated toinbox/[...id].apps/mobile/src/features/inbox/components/DiscussReportSheet.tsxreportTitle?: string | nulland builds the link viainboxReportShareUrl(reportId, reportTitle)(replacing the barecustomSchemeUrl(paths.inboxReport(reportId))).buildDiscussReportPromptfrom@posthog/sharedunchanged.apps/mobile/src/lib/deep-links.test.ts--vs single-, URL-unreserved punctuation passthrough, punctuation-collapse, trim) mirroringapps/code/src/shared/deeplink.test.ts.inboxReportShareUrl(empty title, slug-empty title, colon-run convention).posthog://inbox/<id>/<slug>andhttps://code.posthog.com/inbox/<id>/<slug>, including query-string preservation.No changes to
apps/codeor shared-package code —buildDiscussReportPromptfrom@posthog/sharedis reused as-is.Test plan
pnpm --filter @posthog/mobile test— 156/156 passing including the new slug + inbound-path cases.pnpm --filter @posthog/mobile lint— clean.posthog://inbox/<id>on a device → routes to the report.posthog://inbox/<id>/some-slugon a device → routes to the same report (slug ignored).https://code.posthog.com/inbox/<id>/some-slug(universal link) → routes to the same report.posthog://inbox/<id>/<slug>URL with the slugified title.