Skip to content

Commit

Permalink
Refactor to send to still customersuccess@flagsmith.com
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewelwell committed Aug 21, 2024
1 parent 2931cdf commit 9cb4708
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions api/app/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1238,3 +1238,7 @@
"EDGE_V2_MIGRATION_READ_CAPACITY_BUDGET",
default=0,
)

ORG_SUBSCRIPTION_CANCELLED_ALERT_RECIPIENT_LIST = env.list(
"ORG_SUBSCRIPTION_CANCELLED_ALERT_RECIPIENT_LIST", default=[]
)
14 changes: 10 additions & 4 deletions api/organisations/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from app_analytics.influxdb_wrapper import get_current_api_usage
from django.conf import settings
from django.core.mail import send_mail
from django.db.models import F, Max, Q
from django.utils import timezone
from task_processor.decorators import (
Expand Down Expand Up @@ -73,10 +74,15 @@ def send_org_subscription_cancelled_alert(
organisation_name: str,
formatted_cancellation_date: str,
) -> None:
FFAdminUser.send_alert_to_admin_users(
subject=f"Organisation {organisation_name} has cancelled their subscription",
message=f"Organisation {organisation_name} has cancelled their subscription on {formatted_cancellation_date}",
)
if recipient_list := settings.ORG_SUBSCRIPTION_CANCELLED_ALERT_RECIPIENT_LIST:
send_mail(
subject=f"Organisation {organisation_name} has cancelled their subscription",
message=f"Organisation {organisation_name} has cancelled their subscription "
f"on {formatted_cancellation_date}",
from_email=settings.DEFAULT_FROM_EMAIL,
recipient_list=[recipient_list],
fail_silently=True,
)


@register_recurring_task(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@
{
"name": "ENABLE_API_USAGE_ALERTING",
"value": "True"
},
{
"name": "ORG_SUBSCRIPTION_CANCELLED_ALERT_RECIPIENT_LIST",
"value": "customersuccess@flagsmith.com"
}
],
"secrets": [
Expand Down

0 comments on commit 9cb4708

Please sign in to comment.