Add button to approve broadcast

Since new broadcasts will go into `pending-approval`, we now need a way
of approving them.

This commit adds a button to this page to start (or approve) the
broadcast. This button is wrapped in a bordered box, to emphasise that
it’s something consequential.
This commit is contained in:
Chris Hill-Scott
2020-07-17 08:07:44 +01:00
parent 5b83db9768
commit a99b40304b
6 changed files with 152 additions and 5 deletions

View File

@@ -169,6 +169,32 @@ def view_broadcast_message(service_id, broadcast_message_id):
)
@main.route('/services/<uuid:service_id>/broadcast/<uuid:broadcast_message_id>', methods=['POST'])
@user_has_permissions('send_messages')
@service_has_permission('broadcast')
def approve_broadcast_message(service_id, broadcast_message_id):
broadcast_message = BroadcastMessage.from_id(
broadcast_message_id,
service_id=current_service.id,
)
if broadcast_message.status != 'pending-approval':
return redirect(url_for(
'.view_broadcast_message',
service_id=current_service.id,
broadcast_message_id=broadcast_message.id,
))
broadcast_message.approve_broadcast()
return redirect(url_for(
'.view_broadcast_message',
service_id=current_service.id,
broadcast_message_id=broadcast_message.id,
))
@main.route('/services/<uuid:service_id>/broadcast/<uuid:broadcast_message_id>/cancel')
@user_has_permissions('send_messages')
@service_has_permission('broadcast')