mirror of
https://github.com/healthchecks/healthchecks.git
synced 2025-04-10 23:40:11 +00:00
SMS and phone calls now have separate "limit reached" email templates.
This commit is contained in:
parent
8c13457037
commit
d05691f86f
7 changed files with 45 additions and 2 deletions
|
@ -135,6 +135,13 @@ class Profile(models.Model):
|
||||||
|
|
||||||
emails.sms_limit(self.user.email, ctx)
|
emails.sms_limit(self.user.email, ctx)
|
||||||
|
|
||||||
|
def send_call_limit_notice(self):
|
||||||
|
ctx = {"limit": self.call_limit}
|
||||||
|
if self.call_limit != 500 and settings.USE_PAYMENTS:
|
||||||
|
ctx["url"] = settings.SITE_ROOT + reverse("hc-pricing")
|
||||||
|
|
||||||
|
emails.call_limit(self.user.email, ctx)
|
||||||
|
|
||||||
def projects(self):
|
def projects(self):
|
||||||
""" Return a queryset of all projects we have access to. """
|
""" Return a queryset of all projects we have access to. """
|
||||||
|
|
||||||
|
|
|
@ -487,7 +487,7 @@ class Call(HttpTransport):
|
||||||
def notify(self, check):
|
def notify(self, check):
|
||||||
profile = Profile.objects.for_user(self.channel.project.owner)
|
profile = Profile.objects.for_user(self.channel.project.owner)
|
||||||
if not profile.authorize_call():
|
if not profile.authorize_call():
|
||||||
profile.send_sms_limit_notice("phone call")
|
profile.send_call_limit_notice()
|
||||||
return "Monthly phone call limit exceeded"
|
return "Monthly phone call limit exceeded"
|
||||||
|
|
||||||
url = self.URL % settings.TWILIO_ACCOUNT
|
url = self.URL % settings.TWILIO_ACCOUNT
|
||||||
|
|
|
@ -75,3 +75,7 @@ def deletion_notice(to, ctx, headers={}):
|
||||||
|
|
||||||
def sms_limit(to, ctx):
|
def sms_limit(to, ctx):
|
||||||
send("sms-limit", to, ctx)
|
send("sms-limit", to, ctx)
|
||||||
|
|
||||||
|
|
||||||
|
def call_limit(to, ctx):
|
||||||
|
send("phone-call-limit", to, ctx)
|
||||||
|
|
22
templates/emails/phone-call-limit-body-html.html
Normal file
22
templates/emails/phone-call-limit-body-html.html
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{% extends "emails/base.html" %}
|
||||||
|
{% load hc_extras %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
Hello,<br />
|
||||||
|
<p>
|
||||||
|
We could not deliver a phone call notification because your {% site_name %}
|
||||||
|
account has reached its monthly phone call limit of
|
||||||
|
<strong>{{ limit }} calls per month</strong>. The limit resets at the start of
|
||||||
|
each month.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{% if url %}
|
||||||
|
<p>You can increase the monthly phone call limit by upgrading your billing plan. <a href="{{ url }}">See Pricing</a>.</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content_more %}
|
||||||
|
Regards,<br />
|
||||||
|
The {% site_name %} Team
|
||||||
|
{% endblock %}
|
9
templates/emails/phone-call-limit-body-text.html
Normal file
9
templates/emails/phone-call-limit-body-text.html
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{% load hc_extras %}Hello,
|
||||||
|
|
||||||
|
We could not deliver a phone call notification because your {% site_name %} account has reached its monthly phone call limit of {{ limit }} calls per month. The limit resets at the start of each month.
|
||||||
|
{% if url %}You can increase the monthly phone call limit by upgrading your billing plan.
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
--
|
||||||
|
Regards,
|
||||||
|
The {% site_name %} Team
|
1
templates/emails/phone-call-limit-subject.html
Normal file
1
templates/emails/phone-call-limit-subject.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Monthly Phone Call Limit Reached
|
|
@ -1 +1 @@
|
||||||
Monthly {% if transport == "phone call" %}Phone Call{% else %}{{ transport }}{% endif %} Limit Reached
|
Monthly {{ transport }} Limit Reached
|
Loading…
Add table
Reference in a new issue