Add a confirmation checkbox for live broadcasts

We want people to be really sure before sending a live broadcast, not
just clicking through the green buttons.

This commit adds a checkbox which explains exactly the consequences of
what they’re about to do, tailored to the channel they’re on, and the
area chosen by the person creating the alert.
This commit is contained in:
Chris Hill-Scott
2021-05-12 13:26:13 +01:00
parent 773a51dec1
commit 7d66dadcd7
4 changed files with 196 additions and 10 deletions

View File

@@ -14,6 +14,7 @@ from app.main.forms import (
BroadcastAreaForm,
BroadcastAreaFormWithSelectAll,
BroadcastTemplateForm,
ConfirmBroadcastForm,
NewBroadcastForm,
SearchByNameForm,
)
@@ -401,6 +402,11 @@ def view_broadcast(service_id, broadcast_message_id):
back_link_endpoint,
service_id=current_service.id,
),
form=ConfirmBroadcastForm(
service_is_live=current_service.live,
channel=current_service.broadcast_channel,
max_phones=broadcast_message.count_of_phones_likely,
),
)
@@ -414,6 +420,12 @@ def approve_broadcast_message(service_id, broadcast_message_id):
service_id=current_service.id,
)
form = ConfirmBroadcastForm(
service_is_live=current_service.live,
channel=current_service.broadcast_channel,
max_phones=broadcast_message.count_of_phones_likely,
)
if broadcast_message.status != 'pending-approval':
return redirect(url_for(
'.view_current_broadcast',
@@ -421,14 +433,15 @@ def approve_broadcast_message(service_id, broadcast_message_id):
broadcast_message_id=broadcast_message.id,
))
broadcast_message.approve_broadcast()
if current_service.trial_mode:
broadcast_message.approve_broadcast()
return redirect(url_for(
'.broadcast_tour',
service_id=current_service.id,
step_index=6,
))
elif form.validate_on_submit():
broadcast_message.approve_broadcast()
return redirect(url_for(
'.view_current_broadcast',