Skip to content
Snippets Groups Projects
Commit 4c11d43b authored by Nathan Bockisch's avatar Nathan Bockisch
Browse files

Make sure we don't spam scientists without meaning to

parent ce6581d8
No related branches found
No related tags found
1 merge request!1460Make sure we don't spam scientists without meaning to
Checking pipeline status
......@@ -34,6 +34,8 @@ from pyramid.view import view_config
logger = logging.getLogger(__name__)
NOTIF_SETTINGS_KEY = "edu.nrao.workspaces.NotificationSettings"
from workspaces.capability.enums import CapabilityVersionState
......@@ -434,4 +436,11 @@ def get_user_email(request: Request) -> Response:
if isinstance(email_list, list):
user_email = ", ".join(email_list)
logger.info(f"get_user_email endpoint retrieved: {user_email}")
# We only send emails to the PI/CoI in production!
email_pi = CapoConfig().getboolean("edu.nrao.workspaces.NotificationSettings.sendPIEmail")
if not email_pi:
user_email = CapoConfig().settings(NOTIF_SETTINGS_KEY).analystEmail
return Response(status_int=http.HTTPStatus.OK, json_body={"resp": f"{user_email}"})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment