From 9554248ca3bd0b5a3e8cc96d038fac71488901db Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Thu, 29 Aug 2024 13:57:13 -0500 Subject: [PATCH] Add Notification for failure to add deploy key on manual imported project --- readthedocs/oauth/notifications.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/readthedocs/oauth/notifications.py b/readthedocs/oauth/notifications.py index 15d53eab5fe..e5108f0ef2e 100644 --- a/readthedocs/oauth/notifications.py +++ b/readthedocs/oauth/notifications.py @@ -4,7 +4,7 @@ from django.utils.translation import gettext_lazy as _ -from readthedocs.notifications.constants import ERROR, INFO +from readthedocs.notifications.constants import ERROR, INFO, WARNING from readthedocs.notifications.messages import Message, registry MESSAGE_OAUTH_WEBHOOK_NO_PERMISSIONS = "oauth:webhook:no-permissions" @@ -15,6 +15,9 @@ "oauth:deploy-key:attached-successfully" ) MESSAGE_OAUTH_DEPLOY_KEY_ATTACHED_FAILED = "oauth:deploy-key:attached-failed" +MESSAGE_OAUTH_DEPLOY_KEY_ATTACHED_FAILED_ON_MANUAL_IMPORTED_PROJECT = ( + "oauth:deploy-key:attached-failed-unknown-repo" +) messages = [ Message( @@ -96,5 +99,21 @@ ), type=ERROR, ), + Message( + id=MESSAGE_OAUTH_DEPLOY_KEY_ATTACHED_FAILED_ON_MANUAL_IMPORTED_PROJECT, + header=_("Failed to add deploy key to project"), + body=_( + textwrap.dedent( + """ + We were unable to find this repository in your {{ provider_name }} account. + If this is a private repository, you'll need to + + add the deploy key manually + . + """ + ).strip(), + ), + type=WARNING, + ), ] registry.add(messages)