diff --git a/hc/api/models.py b/hc/api/models.py
index 37e0771b..83a9a83f 100644
--- a/hc/api/models.py
+++ b/hc/api/models.py
@@ -377,7 +377,7 @@ class Channel(models.Model):
if self.kind == "email":
return "Email to %s" % self.email_value
elif self.kind == "sms":
- return "SMS to %s" % self.sms_number
+ return "SMS to %s" % self.phone_number
elif self.kind == "slack":
return "Slack %s" % self.slack_channel
elif self.kind == "telegram":
@@ -642,7 +642,7 @@ class Channel(models.Model):
return Notification.objects.filter(channel=self).latest()
@property
- def sms_number(self):
+ def phone_number(self):
assert self.kind in ("call", "sms", "whatsapp")
if self.value.startswith("{"):
doc = json.loads(self.value)
diff --git a/hc/api/transports.py b/hc/api/transports.py
index d6cd3dc8..37fe9b6c 100644
--- a/hc/api/transports.py
+++ b/hc/api/transports.py
@@ -471,7 +471,7 @@ class Sms(HttpTransport):
data = {
"From": settings.TWILIO_FROM,
- "To": self.channel.sms_number,
+ "To": self.channel.phone_number,
"Body": text,
}
@@ -496,7 +496,7 @@ class Call(HttpTransport):
data = {
"From": settings.TWILIO_FROM,
- "To": self.channel.sms_number,
+ "To": self.channel.phone_number,
"Twiml": twiml,
}
@@ -524,7 +524,7 @@ class WhatsApp(HttpTransport):
data = {
"From": "whatsapp:%s" % settings.TWILIO_FROM,
- "To": "whatsapp:%s" % self.channel.sms_number,
+ "To": "whatsapp:%s" % self.channel.phone_number,
"Body": text,
}
diff --git a/hc/front/tests/test_add_call.py b/hc/front/tests/test_add_call.py
index ecf14ce9..566f6614 100644
--- a/hc/front/tests/test_add_call.py
+++ b/hc/front/tests/test_add_call.py
@@ -32,7 +32,7 @@ class AddCallTestCase(BaseTestCase):
c = Channel.objects.get()
self.assertEqual(c.kind, "call")
- self.assertEqual(c.sms_number, "+1234567890")
+ self.assertEqual(c.phone_number, "+1234567890")
self.assertEqual(c.name, "My Phone")
self.assertEqual(c.project, self.project)
@@ -50,7 +50,7 @@ class AddCallTestCase(BaseTestCase):
self.client.post(self.url, form)
c = Channel.objects.get()
- self.assertEqual(c.sms_number, "+1234567890")
+ self.assertEqual(c.phone_number, "+1234567890")
@override_settings(TWILIO_AUTH=None)
def test_it_requires_credentials(self):
diff --git a/hc/front/tests/test_add_sms.py b/hc/front/tests/test_add_sms.py
index 9ab1c3f6..7a9ec1ef 100644
--- a/hc/front/tests/test_add_sms.py
+++ b/hc/front/tests/test_add_sms.py
@@ -32,7 +32,7 @@ class AddSmsTestCase(BaseTestCase):
c = Channel.objects.get()
self.assertEqual(c.kind, "sms")
- self.assertEqual(c.sms_number, "+1234567890")
+ self.assertEqual(c.phone_number, "+1234567890")
self.assertEqual(c.name, "My Phone")
self.assertEqual(c.project, self.project)
@@ -50,7 +50,7 @@ class AddSmsTestCase(BaseTestCase):
self.client.post(self.url, form)
c = Channel.objects.get()
- self.assertEqual(c.sms_number, "+1234567890")
+ self.assertEqual(c.phone_number, "+1234567890")
@override_settings(TWILIO_AUTH=None)
def test_it_requires_credentials(self):
diff --git a/hc/front/tests/test_add_whatsapp.py b/hc/front/tests/test_add_whatsapp.py
index d6885da1..d2d19ec7 100644
--- a/hc/front/tests/test_add_whatsapp.py
+++ b/hc/front/tests/test_add_whatsapp.py
@@ -44,7 +44,7 @@ class AddWhatsAppTestCase(BaseTestCase):
c = Channel.objects.get()
self.assertEqual(c.kind, "whatsapp")
- self.assertEqual(c.sms_number, "+1234567890")
+ self.assertEqual(c.phone_number, "+1234567890")
self.assertEqual(c.name, "My Phone")
self.assertTrue(c.whatsapp_notify_down)
self.assertTrue(c.whatsapp_notify_up)
@@ -59,7 +59,7 @@ class AddWhatsAppTestCase(BaseTestCase):
c = Channel.objects.get()
self.assertEqual(c.kind, "whatsapp")
- self.assertEqual(c.sms_number, "+1234567890")
+ self.assertEqual(c.phone_number, "+1234567890")
self.assertEqual(c.name, "My Phone")
self.assertFalse(c.whatsapp_notify_down)
self.assertFalse(c.whatsapp_notify_up)
diff --git a/hc/front/tests/test_channels.py b/hc/front/tests/test_channels.py
index 7beb42a8..6953f90b 100644
--- a/hc/front/tests/test_channels.py
+++ b/hc/front/tests/test_channels.py
@@ -1,6 +1,6 @@
import json
-from hc.api.models import Check, Channel, Notification
+from hc.api.models import Channel
from hc.test import BaseTestCase
diff --git a/templates/front/channels.html b/templates/front/channels.html
index bad04b44..6a972be5 100644
--- a/templates/front/channels.html
+++ b/templates/front/channels.html
@@ -67,9 +67,9 @@
user {{ ch.telegram_name }}
{% endif %}
{% elif ch.kind == "sms" %}
- SMS to {{ ch.sms_number }}
+ SMS to {{ ch.phone_number }}
{% elif ch.kind == "call" %}
- Phone call to {{ ch.sms_number }}
+ Phone call to {{ ch.phone_number }}
{% elif ch.kind == "trello" %}
Trello
board {{ ch.trello_board_list|first }},
@@ -77,7 +77,7 @@
{% elif ch.kind == "matrix" %}
Matrix {{ ch.value }}
{% elif ch.kind == "whatsapp" %}
- WhatsApp to {{ ch.sms_number }}
+ WhatsApp to {{ ch.phone_number }}
{% if ch.whatsapp_notify_down and not ch.whatsapp_notify_up %}
(down only)
{% endif %}
diff --git a/templates/front/event_summary.html b/templates/front/event_summary.html
index e9f8a924..ce66c30c 100644
--- a/templates/front/event_summary.html
+++ b/templates/front/event_summary.html
@@ -18,12 +18,12 @@
({{ event.channel.name }})
{% endif %}
{% elif event.channel.kind == "sms" %}
- Sent SMS to {{ event.channel.sms_number }}
+ Sent SMS to {{ event.channel.phone_number }}
{% if event.channel.name %}
({{ event.channel.name }})
{% endif %}
{% elif event.channel.kind == "whatsapp" %}
- Sent WhatsApp message to {{ event.channel.sms_number }}
+ Sent WhatsApp message to {{ event.channel.phone_number }}
{% if event.channel.name %}
({{ event.channel.name }})
{% endif %}
@@ -36,7 +36,7 @@
({{ event.channel.name }})
{% endif %}
{% elif event.channel.kind == "call" %}
- Made a phone call to {{ event.channel.sms_number }}
+ Made a phone call to {{ event.channel.phone_number }}
{% if event.channel.name %}
({{ event.channel.name }})
{% endif %}