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
Show storage add-ons in usage limits #4660
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of unit tests for JS, but I feel that getLimitsForMetadata and others have gotten too complex and merits it. Doesn't need to be now and happy to discuss. Tightening up the types (or simplifying) would mitigate my concern. It feels like the business logic has just gotten a bit too complex from where it started. It's not longer obvious at a glance as to what it's doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed that the Environment API be better off not being user specific but that might be out of scope.
@@ -4,3 +4,15 @@ | |||
'past_due', | |||
'trialing', | |||
] | |||
|
|||
FREE_TIER_NO_THRESHOLDS = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly out of scope. If there was ever a good case for type hints, this is it. Lacking type hints, a DRF serializer on the Environments endpoint would help ensure correctness. But the environments endpoint doesn't have one. IMO this should be considered in a refactor. You could ponder if the added complexity here merits adding a serializer. While not as powerful as real type hints, the serializer would provide a runtime guarantee that data is returned in the expected format. Currently it's a untyped dict that is returned, which cannot provide proof that the API consistently returns the expected format the Frontend needs to accept.
Checklist
Description
Previously purchase storage add-ons are now used in usage limit calculations. Corrects some issues that were causing incorrect limits to be displayed.
Notes
We previously determined whether to show the
FREE_TIER_THRESHOLDS
based on the logged-in user's join date. But for multi-user organizations, that meant each user in the organization could potentially see a different set of limits for their organization. This PR changes that so custom tiers are only shown if the organization owner joined beforeFREE_TIER_CUTOFF_DATE
. If the user isn't in an organization, it still defaults to checking the user's join date.