Skip to content

Commit

Permalink
feat: Tweak email wording for grace periods (#4482)
Browse files Browse the repository at this point in the history
  • Loading branch information
zachaysan authored Aug 13, 2024
1 parent cd4fbe7 commit 36e634c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions api/organisations/task_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def _send_api_usage_notification(
context = {
"organisation": organisation,
"matched_threshold": matched_threshold,
"grace_period": not hasattr(organisation, "breached_grace_period"),
}

send_mail(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
for overages after our first grace period of 30 days.
{% else %}
Please note that once 100% use has been breached, the serving of feature flags and admin access may
be disabled after a 7-day grace period. Please reach out to [email protected] in order to upgrade
your account.
be disabled{% if grace_period %} after a 7-day grace period{% endif %}. Please reach out to
[email protected] in order to upgrade your account.
{% endif %}

</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ If this is expected, no action is required. If you are expecting to go over, you
limits by reaching out to [email protected]. We will automatically charge for overages after our first grace period
of 30 days.
{% else %}
Please note that once 100% use has been breached, the serving of feature flags and admin access may be disabled after a
7-day grace period. Please reach out to [email protected] in order to upgrade your account.
Please note that once 100% use has been breached, the serving of feature flags and admin access may be disabled{% if grace_period %}
after a 7-day grace period{% endif %}. Please reach out to [email protected] in order to upgrade your account.
{% endif %}

Thank you!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
more information. You can reach out to [email protected] if you’d like to take advantage of better
contracted rates.
{% else %}
Please note that the serving of feature flags and admin access will be disabled after a 7 day grace
period until the next subscription period. If you’d like to continue service you can upgrade your
Please note that the serving of feature flags and admin access will be disabled{% if grace_period %} after a 7 day grace
period{% endif %} until the next subscription period. If you’d like to continue service you can upgrade your
organisation’s account (see pricing page).
{% endif %}
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ has reached {{ matched_threshold }}% of your API usage within the current subscr
We will charge for overages after our first grace period of 30 days. Please see the pricing page for more information.
You can reach out to [email protected] if you’d like to take advantage of better contracted rates.
{% else %}
Please note that the serving of feature flags and admin access will be disabled after a 7 day grace period until the
next subscription period. If you’d like to continue service you can upgrade your organisation’s account (see pricing
page).
Please note that the serving of feature flags and admin access will be disabled{% if grace_period %} after a 7 day
grace period{% endif %} until the next subscription period. If you’d like to continue service you can upgrade your
organisation’s account (see pricing page).
{% endif %}

Thank you!
Expand Down
12 changes: 10 additions & 2 deletions api/tests/unit/organisations/test_unit_organisations_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,11 @@ def test_handle_api_usage_notifications_for_free_accounts(
assert email.subject == "Flagsmith API use has reached 100%"
assert email.body == render_to_string(
"organisations/api_usage_notification_limit.txt",
context={"organisation": organisation, "matched_threshold": 100},
context={
"organisation": organisation,
"matched_threshold": 100,
"grace_period": True,
},
)

assert len(email.alternatives) == 1
Expand All @@ -673,7 +677,11 @@ def test_handle_api_usage_notifications_for_free_accounts(

assert email.alternatives[0][0] == render_to_string(
"organisations/api_usage_notification_limit.html",
context={"organisation": organisation, "matched_threshold": 100},
context={
"organisation": organisation,
"matched_threshold": 100,
"grace_period": True,
},
)

assert email.from_email == "[email protected]"
Expand Down

0 comments on commit 36e634c

Please sign in to comment.