support: Use shared template for current plan details on support views.

Moves the section in support views for any current plan details
to a new template: `templates/analytics/current_plan_details.html`.

Also, updates the PlanData dataclass to have a boolean that checks
if the current plan tier is the self-hosted legacy plan.
This commit is contained in:
Lauryn Menard
2023-12-06 18:09:34 +01:00
committed by Tim Abbott
parent 771f8a3542
commit d079a13760
6 changed files with 31 additions and 28 deletions

View File

@@ -18,6 +18,7 @@ class PlanData:
current_plan: Optional["CustomerPlan"] = None
licenses: Optional[int] = None
licenses_used: Optional[int] = None
is_legacy_plan: bool = False
def get_support_url(realm: Realm) -> str:
@@ -55,5 +56,9 @@ def get_current_plan_data_for_support_view(billing_session: BillingSession) -> P
plan_data.current_plan = new_plan # nocoverage
plan_data.licenses = last_ledger_entry.licenses
plan_data.licenses_used = billing_session.current_count_for_billed_licenses()
assert plan_data.current_plan is not None # for mypy
plan_data.is_legacy_plan = (
plan_data.current_plan.tier == CustomerPlan.TIER_SELF_HOSTED_LEGACY
)
return plan_data