mirror of
https://github.com/GSA/notifications-api.git
synced 2026-07-28 03:39:49 -04:00
Allow service.allowed_broadcast_provider to be "all"
We want to replace the value `None` for service.allowed_broadcast_provider with the value of "all". As a first step, we need to allow both values. Once notifications-admin has been changed to pass through "all" and all the data in the database has been updated, we can update the code to stop supporting both values.
This commit is contained in:
@@ -64,7 +64,7 @@ def set_broadcast_service_type(service, service_mode, broadcast_channel, provide
|
||||
db.session.add(service)
|
||||
|
||||
|
||||
def insert_or_update_service_broadcast_settings(service, channel, provider_restriction=None):
|
||||
def insert_or_update_service_broadcast_settings(service, channel, provider_restriction="all"):
|
||||
if not service.service_broadcast_settings:
|
||||
settings = ServiceBroadcastSettings()
|
||||
settings.service = service
|
||||
|
||||
@@ -560,7 +560,8 @@ class Service(db.Model, Versioned):
|
||||
|
||||
def get_available_broadcast_providers(self):
|
||||
# There may be future checks here if we add, for example, platform admin level provider killswitches.
|
||||
if self.allowed_broadcast_provider:
|
||||
# NOTE: We are in the middle of changing the value for all allowed_broadcast_provider from `None`to "all"
|
||||
if self.allowed_broadcast_provider and self.allowed_broadcast_provider != ALL_BROADCAST_PROVIDERS:
|
||||
return [x for x in current_app.config['ENABLED_CBCS'] if x == self.allowed_broadcast_provider]
|
||||
else:
|
||||
return current_app.config['ENABLED_CBCS']
|
||||
@@ -2488,6 +2489,9 @@ class BroadcastProvider:
|
||||
PROVIDERS = [EE, VODAFONE, THREE, O2]
|
||||
|
||||
|
||||
ALL_BROADCAST_PROVIDERS = 'all'
|
||||
|
||||
|
||||
class BroadcastProviderMessageStatus:
|
||||
TECHNICAL_FAILURE = 'technical-failure' # Couldn’t send (cbc proxy 5xx/4xx)
|
||||
SENDING = 'sending' # Sent to cbc, awaiting response
|
||||
|
||||
@@ -6,7 +6,7 @@ service_broadcast_settings_schema = {
|
||||
"properties": {
|
||||
"broadcast_channel": {"enum": ["test", "severe"]},
|
||||
"service_mode": {"enum": ["training", "live"]},
|
||||
"provider_restriction": {"enum": [None, "three", "o2", "vodafone", "ee"]}
|
||||
"provider_restriction": {"enum": [None, "three", "o2", "vodafone", "ee", "all"]}
|
||||
},
|
||||
"required": ["broadcast_channel", "service_mode", "provider_restriction"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user