Browse Source

SMS and phone calls now have separate "limit reached" email templates.

pull/409/head
Pēteris Caune 4 years ago
parent
commit
d05691f86f
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
7 changed files with 45 additions and 2 deletions
  1. +7
    -0
      hc/accounts/models.py
  2. +1
    -1
      hc/api/transports.py
  3. +4
    -0
      hc/lib/emails.py
  4. +22
    -0
      templates/emails/phone-call-limit-body-html.html
  5. +9
    -0
      templates/emails/phone-call-limit-body-text.html
  6. +1
    -0
      templates/emails/phone-call-limit-subject.html
  7. +1
    -1
      templates/emails/sms-limit-subject.html

+ 7
- 0
hc/accounts/models.py View File

@ -135,6 +135,13 @@ class Profile(models.Model):
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):
""" Return a queryset of all projects we have access to. """


+ 1
- 1
hc/api/transports.py View File

@ -487,7 +487,7 @@ class Call(HttpTransport):
def notify(self, check):
profile = Profile.objects.for_user(self.channel.project.owner)
if not profile.authorize_call():
profile.send_sms_limit_notice("phone call")
profile.send_call_limit_notice()
return "Monthly phone call limit exceeded"
url = self.URL % settings.TWILIO_ACCOUNT


+ 4
- 0
hc/lib/emails.py View File

@ -75,3 +75,7 @@ def deletion_notice(to, ctx, headers={}):
def sms_limit(to, ctx):
send("sms-limit", to, ctx)
def call_limit(to, ctx):
send("phone-call-limit", to, ctx)

+ 22
- 0
templates/emails/phone-call-limit-body-html.html View 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
- 0
templates/emails/phone-call-limit-body-text.html View 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
- 0
templates/emails/phone-call-limit-subject.html View File

@ -0,0 +1 @@
Monthly Phone Call Limit Reached

+ 1
- 1
templates/emails/sms-limit-subject.html View File

@ -1 +1 @@
Monthly {% if transport == "phone call" %}Phone Call{% else %}{{ transport }}{% endif %} Limit Reached
Monthly {{ transport }} Limit Reached

Loading…
Cancel
Save