mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
Commitd4ee3023and its parent have the history behind this code. Since d4ee3023^, all new PreregistrationUser objects, except those for realm creation, have a non-None `realm`. Sinced4ee3023, any legacy PreregistrationUsers, with a `realm` of None despite not being for realm creation, are treated as expired. Now, we ignore them completely, and remove any that exist from the database. The user-visible effect is to change the error message for registration (or invitation) links created before d4ee3023^ to be "link does not exist", rather than "link expired". This change will at most affect users upgrading straight from 1.7 or earlier to 1.8 (rather than from 1.7.1), but I think that's not much of a concern (such installations are probably long-running installations, without many live registration or invitation links). [greg: tweaked commit message]
24 lines
810 B
Python
24 lines
810 B
Python
# -*- coding: utf-8 -*-
|
|
# Generated by Django 1.11.6 on 2017-11-30 04:58
|
|
from __future__ import unicode_literals
|
|
|
|
from django.db import migrations, models
|
|
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
|
|
from django.db.migrations.state import StateApps
|
|
|
|
def remove_prereg_users_without_realm(
|
|
apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
|
|
prereg_model = apps.get_model("zerver", "PreregistrationUser")
|
|
prereg_model.objects.filter(realm=None, realm_creation=False).delete()
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('zerver', '0125_realm_max_invites'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(remove_prereg_users_without_realm,
|
|
reverse_code=migrations.RunPython.noop),
|
|
]
|