Commit 25e4287
authored
fix(webhooks): use server-provided inboundUrl for copy on list page (#973)
## Summary
- The webhook list page's "Copy URL" button was constructing inbound
URLs client-side using a local `buildWebhookUrl` helper that always used
`session.user.id` and hardcoded the `/inbound/user/` path prefix. For
org webhooks, this produced URLs with the user's ID instead of the org's
ID and the wrong path prefix (`/inbound/user/` instead of
`/inbound/org/`).
- Fix: the `webhookTriggers.list` tRPC endpoint now includes
`inboundUrl` in each trigger's response (computed server-side via
`buildInboundUrl`, which correctly branches on `organizationId` vs
`userId`). The list page component now reads `trigger.inboundUrl`
directly instead of constructing URLs client-side. This matches the
pattern already used by the admin webhook list and the details page.
- Removed the now-unused `buildWebhookUrl` helper, `useSession` import,
and `encodeUserIdForPath` import from `WebhookTriggersListContent.tsx`.
## Verification
- [x] `pnpm typecheck` passes cleanly across all workspace projects
## Visual Changes
N/A
## Reviewer Notes
- The admin list page (`AdminWebhookTriggersList.tsx`) already followed
the correct pattern: its tRPC endpoint (`admin.webhookTriggers.list`)
calls `buildInboundUrl` per trigger and returns `inboundUrl` in the
response. This fix aligns the non-admin list endpoint to the same
approach.
- The details page was unaffected because it fetches via
`webhookTriggers.get`, which already returned the server-computed
`inboundUrl`.2 files changed
Lines changed: 13 additions & 16 deletions
Lines changed: 5 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | 20 | | |
28 | 21 | | |
29 | 22 | | |
30 | 23 | | |
31 | 24 | | |
32 | 25 | | |
33 | | - | |
34 | | - | |
35 | 26 | | |
36 | 27 | | |
37 | 28 | | |
| |||
63 | 54 | | |
64 | 55 | | |
65 | 56 | | |
66 | | - | |
67 | | - | |
68 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
69 | 60 | | |
70 | 61 | | |
71 | 62 | | |
72 | | - | |
73 | 63 | | |
74 | | - | |
| 64 | + | |
75 | 65 | | |
76 | 66 | | |
77 | 67 | | |
78 | 68 | | |
79 | 69 | | |
80 | 70 | | |
81 | 71 | | |
82 | | - | |
| 72 | + | |
83 | 73 | | |
84 | 74 | | |
85 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
185 | 192 | | |
186 | 193 | | |
187 | 194 | | |
| |||
0 commit comments