From 2beaed481fdd8457ec421953691c6129a6c7509f Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Tue, 5 Nov 2024 06:02:42 -0500 Subject: [PATCH] Notifications: remove unused notification (#11573) ref https://github.com/readthedocs/readthedocs-corporate/issues/1806 --- .../0004_remove_unused_notification.py | 23 +++++++++++++++++++ readthedocs/oauth/notifications.py | 17 +------------- 2 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 readthedocs/notifications/migrations/0004_remove_unused_notification.py diff --git a/readthedocs/notifications/migrations/0004_remove_unused_notification.py b/readthedocs/notifications/migrations/0004_remove_unused_notification.py new file mode 100644 index 00000000000..432da6772cd --- /dev/null +++ b/readthedocs/notifications/migrations/0004_remove_unused_notification.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.16 on 2024-10-29 16:27 + +from django.db import migrations +from django_safemigrate import Safe + + +def remove_unused_notification(apps, schema_editor): + Notification = apps.get_model("notifications", "Notification") + Notification.objects.filter( + message_id="oauth:deploy-key:attached-successfully" + ).delete() + + +class Migration(migrations.Migration): + safe = Safe.after_deploy + + dependencies = [ + ("notifications", "0003_notification_indexes"), + ] + + operations = [ + migrations.RunPython(remove_unused_notification), + ] diff --git a/readthedocs/oauth/notifications.py b/readthedocs/oauth/notifications.py index 15d53eab5fe..b05f539b83b 100644 --- a/readthedocs/oauth/notifications.py +++ b/readthedocs/oauth/notifications.py @@ -4,16 +4,13 @@ from django.utils.translation import gettext_lazy as _ -from readthedocs.notifications.constants import ERROR, INFO +from readthedocs.notifications.constants import ERROR from readthedocs.notifications.messages import Message, registry MESSAGE_OAUTH_WEBHOOK_NO_PERMISSIONS = "oauth:webhook:no-permissions" MESSAGE_OAUTH_WEBHOOK_NO_ACCOUNT = "oauth:webhook:no-account" MESSAGE_OAUTH_WEBHOOK_INVALID = "oauth:webhook:invalid" MESSAGE_OAUTH_BUILD_STATUS_FAILURE = "oauth:status:send-failed" -MESSAGE_OAUTH_DEPLOY_KEY_ATTACHED_SUCCESSFULLY = ( - "oauth:deploy-key:attached-successfully" -) MESSAGE_OAUTH_DEPLOY_KEY_ATTACHED_FAILED = "oauth:deploy-key:attached-failed" messages = [ @@ -72,18 +69,6 @@ ), type=ERROR, ), - Message( - id=MESSAGE_OAUTH_DEPLOY_KEY_ATTACHED_SUCCESSFULLY, - header=_("Deploy key added successfully"), - body=_( - textwrap.dedent( - """ - Successfully added deploy key to {{provider_name}} project. - """ - ).strip(), - ), - type=INFO, - ), Message( id=MESSAGE_OAUTH_DEPLOY_KEY_ATTACHED_FAILED, header=_("Failed to add deploy key to project"),