2016-06-04 16:52:18 +02:00
|
|
|
from typing import Any
|
|
|
|
|
2014-02-14 16:36:20 +01:00
|
|
|
from django.core.management.base import BaseCommand
|
2017-11-16 00:55:49 +01:00
|
|
|
|
2014-02-14 16:36:20 +01:00
|
|
|
from zerver.models import Subscription
|
|
|
|
|
2020-01-14 21:59:46 +01:00
|
|
|
|
2014-02-14 16:36:20 +01:00
|
|
|
class Command(BaseCommand):
|
|
|
|
help = """One-off script to migration users' stream notification settings."""
|
|
|
|
|
2017-10-27 12:57:54 +02:00
|
|
|
def handle(self, *args: Any, **options: Any) -> None:
|
2014-02-14 16:36:20 +01:00
|
|
|
for subscription in Subscription.objects.all():
|
|
|
|
subscription.desktop_notifications = subscription.notifications
|
|
|
|
subscription.audible_notifications = subscription.notifications
|
|
|
|
subscription.save(update_fields=["desktop_notifications",
|
|
|
|
"audible_notifications"])
|