mirror of https://github.com/zulip/zulip.git
[manual] Add script to migrate subs to new stream notification settings.
Previously, streams used `notifications`. Now they have separate `desktop_notifications` and `audible_notifications`. On staging, this should be run after the schema migration has been applied (and technically before the code that uses the new fields is deployed, but for staging, processing our notification settings a few minutes late won't hurt anyone). On prod, the script should be re-run just before the code using the new notification settings is deployed to process any customer notification settings changed since the staging deploy. (imported from commit d99d238cd1b317c5180d7f940d70a7e2f8f9c712)
This commit is contained in:
parent
66edc784f9
commit
4e24b432c4
|
@ -0,0 +1,14 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
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):
|
||||
for subscription in Subscription.objects.all():
|
||||
subscription.desktop_notifications = subscription.notifications
|
||||
subscription.audible_notifications = subscription.notifications
|
||||
subscription.save(update_fields=["desktop_notifications",
|
||||
"audible_notifications"])
|
Loading…
Reference in New Issue