Don’t start broadcasts immediately

We don’t want one person going full yolo and start broadcasting without
any oversight. This commit changes the flow so that the button on the
‘preview’ page puts the broadcast into `pending-approval`, rather than
directly into `broadcasting`.
This commit is contained in:
Chris Hill-Scott
2020-07-17 08:07:43 +01:00
parent 4b1e3ec504
commit 5b83db9768
4 changed files with 5 additions and 7 deletions

View File

@@ -142,7 +142,7 @@ def preview_broadcast_message(service_id, broadcast_message_id):
service_id=current_service.id,
)
if request.method == 'POST':
broadcast_message.start_broadcast()
broadcast_message.request_approval()
return redirect(url_for(
'.broadcast_dashboard',
service_id=current_service.id,

View File

@@ -132,12 +132,11 @@ class BroadcastMessage(JSONModel):
data=kwargs,
)
def start_broadcast(self):
def request_approval(self):
self._update(
starts_at=datetime.utcnow().isoformat(),
finishes_at=(datetime.utcnow() + self.DEFAULT_TTL).isoformat(),
)
self._set_status_to('broadcasting')
self._set_status_to('pending-approval')
def cancel_broadcast(self):
self._set_status_to('cancelled')

View File

@@ -28,7 +28,7 @@
{{ broadcast_message.template|string }}
{% call form_wrapper() %}
{{ sticky_page_footer('Start broadcast') }}
{{ sticky_page_footer('Submit for approval') }}
{% endcall %}
{% endblock %}

View File

@@ -313,12 +313,11 @@ def test_start_broadcasting(
service_id=SERVICE_ONE_ID,
broadcast_message_id=fake_uuid,
data={
'starts_at': '2020-02-02T02:02:02.222222',
'finishes_at': '2020-02-05T02:02:02.222222',
},
)
mock_update_broadcast_message_status.assert_called_once_with(
'broadcasting',
'pending-approval',
service_id=SERVICE_ONE_ID,
broadcast_message_id=fake_uuid,
)