actions: Rename do_change_plan_type -> do change_realm_plan_type.

We will soon be adding an equivalent function for RemoteZulipServer,
so it makes sense to rename this function to be more descriptive.
This commit is contained in:
Eeshan Garg
2021-11-30 20:10:40 -05:00
committed by Tim Abbott
parent 42ecabe967
commit 2cdaae681d
12 changed files with 53 additions and 51 deletions

View File

@@ -714,9 +714,9 @@ def process_initial_upgrade(
)
stripe.Invoice.finalize_invoice(stripe_invoice)
from zerver.lib.actions import do_change_plan_type
from zerver.lib.actions import do_change_realm_plan_type
do_change_plan_type(realm, Realm.PLAN_TYPE_STANDARD, acting_user=user)
do_change_realm_plan_type(realm, Realm.PLAN_TYPE_STANDARD, acting_user=user)
def update_license_ledger_for_manual_plan(
@@ -937,9 +937,9 @@ def update_sponsorship_status(
def approve_sponsorship(realm: Realm, *, acting_user: Optional[UserProfile]) -> None:
from zerver.lib.actions import do_change_plan_type, internal_send_private_message
from zerver.lib.actions import do_change_realm_plan_type, internal_send_private_message
do_change_plan_type(realm, Realm.PLAN_TYPE_STANDARD_FREE, acting_user=acting_user)
do_change_realm_plan_type(realm, Realm.PLAN_TYPE_STANDARD_FREE, acting_user=acting_user)
customer = get_customer_by_realm(realm)
if customer is not None and customer.sponsorship_pending:
customer.sponsorship_pending = False
@@ -986,10 +986,10 @@ def do_change_plan_status(plan: CustomerPlan, status: int) -> None:
def process_downgrade(plan: CustomerPlan) -> None:
from zerver.lib.actions import do_change_plan_type
from zerver.lib.actions import do_change_realm_plan_type
assert plan.customer.realm is not None
do_change_plan_type(plan.customer.realm, Realm.PLAN_TYPE_LIMITED, acting_user=None)
do_change_realm_plan_type(plan.customer.realm, Realm.PLAN_TYPE_LIMITED, acting_user=None)
plan.status = CustomerPlan.ENDED
plan.save(update_fields=["status"])