zulip/zilencer
Mateusz Mandera 834dbd552b remote_billing: Make handle_customer_migration_... more robust.
The logic in the case where there's only one realm and the function
tries to migrate the server's plan to it, had two main unhandled edge
cases that would throw exceptions:
1.
```
        remote_realm = RemoteRealm.objects.get(
            uuid=realm_uuids[0], plan_type=RemoteRealm.PLAN_TYPE_SELF_MANAGED
        )
```

This could throw an exception if the RemoteRealm exists, but has an
active e.g. Legacy plan. Then there'd be no object matching the
plan_type in the query, raising RemoteRealm.DoesNotExist.

2. If the RemoteRealm had e.g. a Legacy plan in the past, that's now
   expired, then it'd have a Customer object. Meaning that the attempt
   to move the server's customer to the realm:
   `server_plan.customer = remote_realm_customer`
   would trigger an IntegrityError since a RemoteRealm can't have two
   Customer objects.

In simple cases the situation in (2) can still be easily migrated, by
moving the plan from the server's customer to the realm's customer.
2024-02-20 16:02:03 -08:00
..
lib python: Consistently use from…import for datetime. 2023-12-05 12:01:18 -08:00
management message: Move render_markdown into zerver.lib.markdown. 2024-02-14 12:27:03 -08:00
migrations zilencer: Add index on RemoteInstallationCount for remote activity. 2024-02-01 12:01:16 -08:00
README.md docs: Format Markdown with Prettier. 2021-09-08 12:06:24 -07:00
__init__.py
auth.py zilencer: Add last_request_datetime to RemoteRealm + RemoteZulipServer. 2024-01-05 13:09:09 -08:00
models.py zilencer: Add index on RemoteInstallationCount for remote activity. 2024-02-01 12:01:16 -08:00
urls.py remote_billing: Rename the _billing_entry and _finalize_login functions. 2023-12-05 11:34:57 -08:00
views.py remote_billing: Make handle_customer_migration_... more robust. 2024-02-20 16:02:03 -08:00

README.md

ZILENCER -- The Zulip license manager

This app is the place for storing state about various deployments of Zulip that exist in the world.