Remove hardcoded default to use test channel

There is no need for a default now as every broadcast service has set on
it which broadcast channel to use.
This commit is contained in:
David McDonald
2021-02-19 11:38:10 +00:00
parent 9b21e6b04f
commit 3ea86bfb48
4 changed files with 4 additions and 78 deletions

View File

@@ -140,10 +140,6 @@ def send_broadcast_provider_message(self, broadcast_event_id, provider):
for polygon in broadcast_event.transmitted_areas["simple_polygons"]
]
channel = "test"
if broadcast_event.service.broadcast_channel:
channel = broadcast_event.service.broadcast_channel
cbc_proxy_provider_client = cbc_proxy_client.get_proxy(provider)
try:
@@ -156,7 +152,7 @@ def send_broadcast_provider_message(self, broadcast_event_id, provider):
areas=areas,
sent=broadcast_event.sent_at_as_cap_datetime_string,
expires=broadcast_event.transmitted_finishes_at_as_cap_datetime_string,
channel=channel
channel=broadcast_event.service.broadcast_channel
)
elif broadcast_event.message_type == BroadcastEventMessageType.UPDATE:
cbc_proxy_provider_client.update_and_send_broadcast(
@@ -174,7 +170,7 @@ def send_broadcast_provider_message(self, broadcast_event_id, provider):
# but we are relying on service channels changing almost never, and not mid incident
# We may consider in the future, changing this such that we store the channel a broadcast was
# sent on on the broadcast message itself and pick the value from there instead of the service
channel=channel
channel=broadcast_event.service.broadcast_channel
)
elif broadcast_event.message_type == BroadcastEventMessageType.CANCEL:
cbc_proxy_provider_client.cancel_broadcast(

View File

@@ -25,7 +25,7 @@ from notifications_utils.recipients import (
from app import ma
from app import models
from app.models import ServicePermission, BROADCAST_TYPE
from app.models import ServicePermission
from app.dao.permissions_dao import permission_dao
from app.utils import DATETIME_FORMAT_NO_TIMEZONE, get_template_instance
@@ -242,14 +242,7 @@ class ServiceSchema(BaseSchema, UUIDsAsStringsMixin):
return service.allowed_broadcast_provider
def _get_broadcast_channel(self, service):
# TODO: Once we've migrated data so that all broadcast services have `service.broadcast_channel`
# set then we can remove this logic and related tests and instead just return
# `service.broadcast_channel`. For the moment though, as we have some services with the broadcast
# permission that do not have a row in the service_broadcast_settings table, we need to hardcode
# this in here to give them a default that the admin app can use
if BROADCAST_TYPE in self.service_permissions(service):
return service.broadcast_channel if service.broadcast_channel else "test"
return None
return service.broadcast_channel
def get_letter_logo_filename(self, service):
return service.letter_branding and service.letter_branding.filename