From d5d3f14eeeed217b3da4bbb74194af5295e1d05b Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Bodas Date: Mon, 19 Jul 2021 14:26:34 +0530 Subject: [PATCH] models: Add UserProfile field for custom email notifs batching periods. The default is 2 minutes (120 seconds), which was the hardcoded value earlier. --- ...334_email_notifications_batching_period.py | 23 +++++++++++++++++++ zerver/models.py | 3 +++ 2 files changed, 26 insertions(+) create mode 100644 zerver/migrations/0334_email_notifications_batching_period.py diff --git a/zerver/migrations/0334_email_notifications_batching_period.py b/zerver/migrations/0334_email_notifications_batching_period.py new file mode 100644 index 0000000000..2aeb19b05d --- /dev/null +++ b/zerver/migrations/0334_email_notifications_batching_period.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.5 on 2021-07-19 11:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("zerver", "0333_alter_realm_org_type"), + ] + + operations = [ + migrations.AddField( + model_name="realmuserdefault", + name="email_notifications_batching_period_seconds", + field=models.IntegerField(default=120), + ), + migrations.AddField( + model_name="userprofile", + name="email_notifications_batching_period_seconds", + field=models.IntegerField(default=120), + ), + ] diff --git a/zerver/models.py b/zerver/models.py index 80989efd2d..759071f741 100644 --- a/zerver/models.py +++ b/zerver/models.py @@ -1299,6 +1299,8 @@ class UserBaseSettings(models.Model): ### Notifications settings. ### + email_notifications_batching_period_seconds: int = models.IntegerField(default=120) + # Stream notifications. enable_stream_desktop_notifications: bool = models.BooleanField(default=False) enable_stream_email_notifications: bool = models.BooleanField(default=False) @@ -1350,6 +1352,7 @@ class UserBaseSettings(models.Model): enable_digest_emails=bool, enable_login_emails=bool, enable_marketing_emails=bool, + email_notifications_batching_period_seconds=int, enable_offline_email_notifications=bool, enable_offline_push_notifications=bool, enable_online_push_notifications=bool,