Skip to content

Commit

Permalink
Notifications: remove unused notification (#11573)
Browse files Browse the repository at this point in the history
  • Loading branch information
stsewd authored Nov 5, 2024
1 parent 40b8808 commit 2beaed4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -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),
]
17 changes: 1 addition & 16 deletions readthedocs/oauth/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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"),
Expand Down

0 comments on commit 2beaed4

Please sign in to comment.