mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-29 03:43:09 -04:00
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:
@@ -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,
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
{{ broadcast_message.template|string }}
|
||||
|
||||
{% call form_wrapper() %}
|
||||
{{ sticky_page_footer('Start broadcast') }}
|
||||
{{ sticky_page_footer('Submit for approval') }}
|
||||
{% endcall %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user