Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
corporate: Clean up code remaining comments with "legacy plan".
Lauryn Menard261333c37f5a
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.pyindex 2dda0d7f259..157bfd636ed 100644--- a/corporate/lib/stripe.py+++ b/corporate/lib/stripe.py@@ -1787,7 +1787,7 @@ class BillingSession(ABC):if next_plan is not None: # nocoveragereturn f"Customer scheduled for upgrade to {next_plan.name}. Please cancel upgrade before approving sponsorship!"- # It is fine to end legacy plan not scheduled for an upgrade.+ # It is fine to end a complimentary access plan not scheduled for an upgrade.if current_plan.tier != CustomerPlan.TIER_SELF_HOSTED_LEGACY:return f"Customer on plan {current_plan.name}. Please end current plan before approving sponsorship!"@@ -2791,7 +2791,7 @@ class BillingSession(ABC):free_trial_days = Nonefree_trial_end_date = None- # Don't show free trial for remote servers on legacy plan.+ # Don't show free trial for customers on a complimentary access plan.is_self_hosted_billing = not isinstance(self, RealmBillingSession)if fixed_price is None and complimentary_access_plan_end_date is None:free_trial_days = get_free_trial_days(is_self_hosted_billing, tier)@@ -3842,8 +3842,8 @@ class BillingSession(ABC):customer = self.update_or_create_customer()plan = get_current_plan_by_customer(customer)- # Only plan that can be active is legacy plan. Which is already- # ended by the support path from which is this function is called.+ # The only plan that could be active is a complimentary access plan, which+ # was already ended by the support path from which is this function is called.assert plan is Nonenow = timezone_now()community_plan_params = {@@ -5411,8 +5411,9 @@ def get_plan_renewal_or_end_date(plan: CustomerPlan, event_time: datetime) -> dadef invoice_plans_as_needed(event_time: datetime | None = None) -> None:if event_time is None:event_time = timezone_now()- # For self hosted legacy plan with status SWITCH_PLAN_TIER_AT_PLAN_END, we need- # to invoice legacy plan followed by new plan on the same day, hence ordered by ID.+ # For complimentary access plans with status SWITCH_PLAN_TIER_AT_PLAN_END, we need+ # to invoice the complimentary access plan followed by the new plan on the same day,+ # hence ordering by ID.for plan in CustomerPlan.objects.filter(next_invoice_date__lte=event_time).order_by("id"):remote_server: RemoteZulipServer | None = Noneif plan.customer.realm is not None:diff --git a/corporate/tests/test_activity_views.py b/corporate/tests/test_activity_views.pyindex 1cd05f1003f..17ab2b52f6e 100644--- a/corporate/tests/test_activity_views.py+++ b/corporate/tests/test_activity_views.py@@ -325,7 +325,7 @@ class ActivityTest(ZulipTestCase):realm_date_created=datetime(2023, 12, 1, tzinfo=timezone.utc),)- # Remote server on legacy plan+ # Remote server on complimentary access planserver = RemoteZulipServer.objects.get(hostname="zulip-1.example.com")customer = Customer.objects.create(remote_server=server)add_plan(customer, tier=CustomerPlan.TIER_SELF_HOSTED_LEGACY)diff --git a/corporate/tests/test_remote_billing.py b/corporate/tests/test_remote_billing.pyindex 233ade98974..6194188a7ab 100644--- a/corporate/tests/test_remote_billing.py+++ b/corporate/tests/test_remote_billing.py@@ -819,8 +819,8 @@ class RemoteBillingAuthenticationTest(RemoteRealmBillingTestCase):["zephyr.testserver", "lear.testserver"],)- # Check legacy CustomerPlan exists for the one non-deactivated "real" realm- # and does not for the bot realm.+ # Check complimentary access CustomerPlan exists for the one non-deactivated+ # "real" realm and does not for the bot realm.# Sanity check that the setup for this test is the way we think it is.self.assertEqual(RemoteRealm.objects.filter(realm_deactivated=False).count(), 2)@@ -1486,8 +1486,7 @@ class LegacyServerLoginTest(RemoteServerTestCase):self.assertEqual(result["Location"], f"/server/{self.uuid}/sponsorship/")result = self.client_get(result["Location"], subdomain="selfhosting")- # TODO Update the string when we have a complete sponsorship page for legacy servers.- self.assert_in_success_response(["Request Zulip", "sponsorship"], result)+ self.assert_in_success_response(["Request Zulip", "sponsorship", "Community"], result)def test_server_login_next_page_in_form_persists(self) -> None:result = self.client_get("/serverlogin/?next_page=billing", subdomain="selfhosting")diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.pyindex 6a03b93fe89..bb00cf64939 100644--- a/corporate/tests/test_stripe.py+++ b/corporate/tests/test_stripe.py@@ -681,7 +681,7 @@ class StripeTestCase(ZulipTestCase):not existing_customer):# Upgrade already happened for free trial, invoice realms or schedule- # upgrade for legacy remote servers.+ # upgrade for customers on complimentary access plan.return upgrade_json_responselast_sent_invoice = Invoice.objects.last()@@ -7170,9 +7170,10 @@ class TestRemoteRealmBillingFlow(StripeTestCase, RemoteRealmBillingTestCase):@responses.activate@mock_stripe()def test_upgrade_user_to_basic_plan_free_trial_fails_special_case(self, *mocks: Mock) -> None:- # Here we test if server had a legacy plan but never it ended before we could ever migrate- # it to remote realm resulting in the upgrade for remote realm creating a new customer which- # doesn't have any legacy plan associated with it. In this case, free trail should not be offered.+ # Here we test if server had a complimentary access plan that ended before we could migrate+ # it to a remote realm resulting in the upgrade for remote realm creating a new customer which+ # doesn't have any complimentary access plan associated with it. In this case, a free trial+ # should not be offered.with self.settings(SELF_HOSTING_FREE_TRIAL_DAYS=30):self.login("hamlet")hamlet = self.example_user("hamlet")@@ -7201,7 +7202,7 @@ class TestRemoteRealmBillingFlow(StripeTestCase, RemoteRealmBillingTestCase):result,)- # Add ended legacy plan for remote realm server.+ # Add ended complimentary access plan for remote realm server.new_server_customer = Customer.objects.create(remote_server=self.remote_realm.server)CustomerPlan.objects.create(customer=new_server_customer,@@ -8710,8 +8711,8 @@ class TestRemoteRealmBillingFlow(StripeTestCase, RemoteRealmBillingTestCase):with time_machine.travel(end_date, tick=False):send_server_data_to_push_bouncer(consider_usage_statistics=False)invoice_plans_as_needed()- # 'invoice_plan()' is called with both legacy & new plan, but- # invoice is created only for new plan. The legacy plan only goes+ # 'invoice_plan()' is called with both complimentary access & new plan, but+ # invoice is created only for new plan. The complimentary access plan only goes# through the end of cycle updates.realm_legacy_plan.refresh_from_db()@@ -10210,11 +10211,11 @@ class TestRemoteServerBillingFlow(StripeTestCase, RemoteServerTestCase):time_machine.travel(plan_end_date, tick=False),):invoice_plans_as_needed()- # Verify that for legacy plan with no next plan scheduled,- # invoice overdue email is not sent even if the last audit log- # update was 3 months ago.+ # Verify that for complimentary access plan with no next plan scheduled,+ # invoice overdue email is not sent even if the last audit log update was+ # 3 months ago.send_email.assert_not_called()- # The legacy plan is downgraded, no invoice created.+ # The complimentary access plan is downgraded, no invoice created.invoice_create.assert_not_called()plan.refresh_from_db()@@ -10279,16 +10280,16 @@ class TestRemoteServerBillingFlow(StripeTestCase, RemoteServerTestCase):time_machine.travel(end_date, tick=False),):invoice_plans_as_needed()- # Verify that for legacy plan with next plan scheduled, invoice- # overdue email is sent if the last audit log is stale.+ # Verify that for complimentary access plan with next plan scheduled,+ # invoice overdue email is sent if the last audit log is stale.send_email.assert_called()invoice_create.assert_not_called()with time_machine.travel(end_date, tick=False):send_server_data_to_push_bouncer(consider_usage_statistics=False)invoice_plans_as_needed()- # 'invoice_plan()' is called with both legacy & new plan, but- # invoice is created only for new plan. The legacy plan only+ # 'invoice_plan()' is called with both complimentary access & new plan, but+ # invoice is created only for new plan. The complimentary access plan only# goes through the end of cycle updates.legacy_plan.refresh_from_db()