2017-09-01 14:22:18 +02:00
|
|
|
# Generated by Django 1.11.4 on 2017-08-30 00:26
|
2017-11-16 00:44:00 +01:00
|
|
|
from django.db import migrations
|
2022-05-27 23:33:51 +02:00
|
|
|
from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor
|
2017-09-01 14:22:18 +02:00
|
|
|
from django.db.migrations.state import StateApps
|
|
|
|
|
|
|
|
from zerver.lib.fix_unreads import fix
|
|
|
|
|
2020-01-14 21:59:46 +01:00
|
|
|
|
2022-05-27 23:33:51 +02:00
|
|
|
def fix_unreads(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None:
|
2017-09-01 14:22:18 +02:00
|
|
|
UserProfile = apps.get_model("zerver", "UserProfile")
|
|
|
|
user_profiles = list(UserProfile.objects.filter(is_bot=False))
|
|
|
|
for user_profile in user_profiles:
|
|
|
|
fix(user_profile)
|
|
|
|
|
2021-02-12 08:19:30 +01:00
|
|
|
|
2017-09-01 14:22:18 +02:00
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
2021-02-12 08:20:45 +01:00
|
|
|
("zerver", "0103_remove_userprofile_muted_topics"),
|
2017-09-01 14:22:18 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
2020-04-29 08:43:25 +02:00
|
|
|
migrations.RunPython(fix_unreads, elidable=True),
|
2017-09-01 14:22:18 +02:00
|
|
|
]
|