Repository: readthedocs/readthedocs.org

Issue:
Notifications: remove unused email account settings
Noticed these are still tucked away in the user profile form:

![image](https://github.com/readthedocs/readthedocs.org/assets/1140183/2cd6b613-f6d6-411c-8866-ae8e2489e064)

They are both expired deprecations and we talked about moving these to a dedicated form anyways.


Discussion:

Resolving patch:
diff --git a/readthedocs/core/forms.py b/readthedocs/core/forms.py
--- a/readthedocs/core/forms.py
+++ b/readthedocs/core/forms.py
@@ -1,8 +1,6 @@
 """Forms for core app."""
 
 import structlog
-from crispy_forms.helper import FormHelper
-from crispy_forms.layout import Fieldset, Layout, Submit
 from django import forms
 from django.contrib.auth.models import User
 from django.core.exceptions import NON_FIELD_ERRORS
@@ -23,15 +21,7 @@ class UserProfileForm(forms.ModelForm):
     class Meta:
         model = UserProfile
         # Don't allow users edit someone else's user page
-        profile_fields = ["first_name", "last_name", "homepage"]
-        optout_email_fields = [
-            "optout_email_config_file_deprecation",
-            "optout_email_build_image_deprecation",
-        ]
-        fields = (
-            *profile_fields,
-            *optout_email_fields,
-        )
+        fields = ["first_name", "last_name", "homepage"]
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
@@ -41,20 +31,6 @@ def __init__(self, *args, **kwargs):
         except AttributeError:
             pass
 
-        self.helper = FormHelper()
-        field_sets = [
-            Fieldset(
-                _("User settings"),
-                *self.Meta.profile_fields,
-            ),
-            Fieldset(
-                _("Email settings"),
-                *self.Meta.optout_email_fields,
-            ),
-        ]
-        self.helper.layout = Layout(*field_sets)
-        self.helper.add_input(Submit("save", _("Save")))
-
     def save(self, commit=True):
         first_name = self.cleaned_data.pop("first_name", None)
         last_name = self.cleaned_data.pop("last_name", None)
diff --git a/readthedocs/core/migrations/0015_remove_email_options.py b/readthedocs/core/migrations/0015_remove_email_options.py
new file mode 100644
--- /dev/null
+++ b/readthedocs/core/migrations/0015_remove_email_options.py
@@ -0,0 +1,31 @@
+# Generated by Django 4.2.10 on 2024-02-27 18:55
+
+from django.db import migrations
+from django_safemigrate import Safe
+
+
+class Migration(migrations.Migration):
+    safe = Safe.after_deploy
+
+    dependencies = [
+        ("core", "0014_optout_email_build_image_deprecation"),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name="historicaluserprofile",
+            name="optout_email_build_image_deprecation",
+        ),
+        migrations.RemoveField(
+            model_name="historicaluserprofile",
+            name="optout_email_config_file_deprecation",
+        ),
+        migrations.RemoveField(
+            model_name="userprofile",
+            name="optout_email_build_image_deprecation",
+        ),
+        migrations.RemoveField(
+            model_name="userprofile",
+            name="optout_email_config_file_deprecation",
+        ),
+    ]
diff --git a/readthedocs/core/models.py b/readthedocs/core/models.py
--- a/readthedocs/core/models.py
+++ b/readthedocs/core/models.py
@@ -43,22 +43,6 @@ class UserProfile(TimeStampedModel):
     whitelisted = models.BooleanField(_("Whitelisted"), default=False)
     banned = models.BooleanField(_("Banned"), default=False)
 
-    # Opt-out on emails
-    # NOTE: this is a temporary field that we can remove after September 25, 2023
-    # See https://blog.readthedocs.com/migrate-configuration-v2/
-    optout_email_config_file_deprecation = models.BooleanField(
-        _("Opt-out from email about 'Config file deprecation'"),
-        default=False,
-        null=True,
-    )
-    # NOTE: this is a temporary field that we can remove after October 16, 2023
-    # See https://blog.readthedocs.com/use-build-os-config/
-    optout_email_build_image_deprecation = models.BooleanField(
-        _("Opt-out from email about '\"build.image\" config key deprecation'"),
-        default=False,
-        null=True,
-    )
-
     # Model history
     history = ExtraHistoricalRecords()
 


Test patch: