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

18 lines
694 B
Python
Raw Normal View History

from __future__ import absolute_import
from typing import Any
from django.core.management.base import BaseCommand
from zerver.models import Subscription
class Command(BaseCommand):
help = """One-off script to migration users' stream notification settings."""
def handle(self, *args, **options):
# type: (*Any, **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"])