2017-09-01 14:22:18 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# 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
|
2017-09-01 14:22:18 +02:00
|
|
|
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
|
|
|
|
from django.db.migrations.state import StateApps
|
|
|
|
|
|
|
|
from zerver.lib.fix_unreads import fix
|
|
|
|
|
2020-01-14 21:59:46 +01:00
|
|
|
|
2017-10-26 11:36:30 +02:00
|
|
|
def fix_unreads(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> 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)
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
|
|
|
dependencies = [
|
|
|
|
('zerver', '0103_remove_userprofile_muted_topics'),
|
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
|
|
|
migrations.RunPython(fix_unreads),
|
|
|
|
]
|