diff --git a/TWLight/users/forms.py b/TWLight/users/forms.py index f445ebc03b..fa1d234f41 100644 --- a/TWLight/users/forms.py +++ b/TWLight/users/forms.py @@ -100,6 +100,7 @@ def __init__(self, user, *args, **kwargs): class UserEmailForm(forms.Form): send_renewal_notices = forms.BooleanField(required=False) + enable_suggestion_notification = forms.BooleanField(required=False) def __init__(self, user, *args, **kwargs): super(UserEmailForm, self).__init__(*args, **kwargs) @@ -110,6 +111,13 @@ def __init__(self, user, *args, **kwargs): "send_renewal_notices" # Translators: In the preferences section (Emails) of a user profile, this text labels the checkbox users can (un)click to change if they wish to receive account renewal notices or not. ].label = _("Send renewal notices") + self.fields[ + "enable_suggestion_notification" + ].initial = user.userprofile.enable_suggestion_notification + self.fields[ + "enable_suggestion_notification" + # Translators: In the preferences section (Emails) of a user profile, this text labels the checkbox users can (un)click to change if they wish to receive suggestion notifications. + ].label = _("Send notices when upvoted suggestions become available") class CoordinatorEmailForm(forms.Form): diff --git a/TWLight/users/migrations/0091_userprofile_enable_suggestion_notification.py b/TWLight/users/migrations/0091_userprofile_enable_suggestion_notification.py new file mode 100644 index 0000000000..6a0529ca39 --- /dev/null +++ b/TWLight/users/migrations/0091_userprofile_enable_suggestion_notification.py @@ -0,0 +1,20 @@ +# Generated by Django 3.2.18 on 2023-05-19 12:31 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("users", "0090_alter_userprofile_lang"), + ] + + operations = [ + migrations.AddField( + model_name="userprofile", + name="enable_suggestion_notification", + field=models.BooleanField( + default=True, help_text="Does this user want suggestion notifications?" + ), + ), + ] diff --git a/TWLight/users/models.py b/TWLight/users/models.py index bbf022e352..002f9afec3 100644 --- a/TWLight/users/models.py +++ b/TWLight/users/models.py @@ -121,6 +121,9 @@ class Meta: send_renewal_notices = models.BooleanField( default=True, help_text="Does this user want renewal reminder notices?" ) + enable_suggestion_notification = models.BooleanField( + default=True, help_text="Does this user want suggestion notifications?" + ) pending_app_reminders = models.BooleanField( default=True, help_text="Does this coordinator want pending app reminder notices?",