mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
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:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user