Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reload available features upgraded #29161

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

zlwaterfield
Copy link
Contributor

@zlwaterfield zlwaterfield commented Feb 25, 2025

Changes

Following up on https://github.com/PostHog/billing/pull/1121.

After a user upgrades, this is meant to make sure the latest available features are loaded.

Paths for when they need to be reloaded

  • initially subscribing from onboarding or billing page
  • adding an add-on
  • adding a trial
  • removing an add-on
  • canceling a trial
  • unsubscribing

This PR handles all of the above. There is much room to improve here how we sync avail features to organizations but this is a big improvement to the UX because right now the proper features are not loaded in until you refresh.

👉 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?

@zlwaterfield zlwaterfield self-assigned this Feb 25, 2025
@zlwaterfield zlwaterfield marked this pull request as ready for review February 25, 2025 02:29
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR enhances feature availability synchronization after billing changes in PostHog. Here's a concise summary of the key changes:

  • Added update_available_product_features method in billing_manager.py to fetch and update organization features from billing service
  • Integrated feature reloading in billingLogic.tsx by calling loadCurrentOrganization after billing upgrades
  • Added automatic feature refresh after trial activation/cancellation in billing manager
  • Removed unused plan_keys parameter from get_billing method for cleaner code

The changes ensure that users immediately see their updated feature access after any billing-related changes without requiring a page refresh.

2 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

github-actions bot commented Feb 25, 2025

Size Change: +332 B (0%)

Total Size: 9.72 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 9.72 MB +332 B (0%)

compressed-size-action

billing_manager = self.get_billing_manager()
query = {}
if "include_forecasting" in request.query_params:
query["include_forecasting"] = request.query_params.get("include_forecasting")
response = billing_manager.get_billing(org, plan_keys, query)
response = billing_manager.get_billing(org, query)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean up of unused arg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants