mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
billing: Show the billing page only to admins and billing users.
This commit is contained in:
@@ -199,10 +199,10 @@ def billing_home(request: HttpRequest) -> HttpResponse:
|
||||
if customer is None:
|
||||
return HttpResponseRedirect(reverse('zilencer.views.initial_upgrade'))
|
||||
|
||||
# TODO
|
||||
# if not user.is_realm_admin and not user == customer.billing_user:
|
||||
# context['error_message'] = _("You must be an administrator to view this page.")
|
||||
# return render(request, 'zilencer/billing.html', context=context)
|
||||
if not user.is_realm_admin and not user == customer.billing_user:
|
||||
context = {'admin_access': False} # type: Dict[str, Any]
|
||||
return render(request, 'zilencer/billing.html', context=context)
|
||||
context = {'admin_access': True}
|
||||
|
||||
stripe_customer = get_stripe_customer(customer.stripe_customer_id)
|
||||
|
||||
@@ -230,7 +230,7 @@ def billing_home(request: HttpRequest) -> HttpResponse:
|
||||
if source is not None:
|
||||
payment_method = "Card ending in %(last4)s" % {'last4': source.last4}
|
||||
|
||||
context = {
|
||||
context.update({
|
||||
'plan_name': plan_name,
|
||||
'seat_count': seat_count,
|
||||
'renewal_date': renewal_date,
|
||||
@@ -238,6 +238,6 @@ def billing_home(request: HttpRequest) -> HttpResponse:
|
||||
'payment_method': payment_method,
|
||||
'prorated_charges': '{:,.2f}'.format(prorated_charges),
|
||||
'prorated_credits': '{:,.2f}'.format(prorated_credits),
|
||||
} # type: Dict[str, Any]
|
||||
})
|
||||
|
||||
return render(request, 'zilencer/billing.html', context=context)
|
||||
|
||||
Reference in New Issue
Block a user