PostHog / posthog

đŸĻ” PostHog provides open-source product analytics, session recording, feature flagging and A/B testing that you can self-host.
https://posthog.com
Other
19.39k stars 1.13k forks source link

feat: add a portal redirect endpoint #23375

Closed zlwaterfield closed 2 days ago

zlwaterfield commented 3 days ago

Problem

Right now we load a portal session every time the user loads the app and we only cache it for 60 seconds which means we generate a TON of them. This isn't good practice and they should really be generated jit-in-time when the user requests it.

Changes

This PR updates the stripe_portal_url in the billing response to be a fixed endpoint from the API that the client can redirect to, which will generate the portal session and redirect the user to. No other changes have been made. Nice and simple :)

I updated the fixtures to match this pattern and added a test for portal endpoint.

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

How did you test this code?

Tested manually and added a test.

github-actions[bot] commented 3 days ago

Size Change: 0 B

Total Size: 1.06 MB

ℹī¸ View Unchanged | Filename | Size | | :--- | :---: | | `frontend/dist/toolbar.js` | 1.06 MB |

compressed-size-action