zulip/zilencer/management/commands/migrate_stream_notification...

17 lines
636 B
Python
Raw Normal View History

from typing import Any
from django.core.management.base import BaseCommand
2017-11-16 00:55:49 +01:00
from zerver.models import Subscription
class Command(BaseCommand):
help = """One-off script to migration users' stream notification settings."""
def handle(self, *args: Any, **options: Any) -> None:
for subscription in Subscription.objects.all():
subscription.desktop_notifications = subscription.notifications
subscription.audible_notifications = subscription.notifications
subscription.save(update_fields=["desktop_notifications",
"audible_notifications"])