Add a page to view a single broadcast

This commit adds a page to view a single broadcast. This is important
for two reasons:
- users need an audit of what happened when, and who else was involved
  in approving or cancelling a broadcast
- we need a place to put actions (approving, cancelling) on a broadcast
  so that you can confirm details of the message and the areas before
  performing the action
This commit is contained in:
Chris Hill-Scott
2020-07-10 14:06:00 +01:00
parent 1a79a037f6
commit 7d6dffc098
8 changed files with 215 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
from flask import redirect, render_template, request, url_for
from flask import abort, redirect, render_template, request, url_for
from app import current_service
from app.main import main
@@ -19,7 +19,7 @@ def broadcast_dashboard(service_id):
)
@main.route('/services/<uuid:service_id>/broadcast/<uuid:template_id>')
@main.route('/services/<uuid:service_id>/new-broadcast/<uuid:template_id>')
@user_has_permissions('send_messages')
@service_has_permission('broadcast')
def broadcast(service_id, template_id):
@@ -127,6 +127,22 @@ def preview_broadcast_message(service_id, broadcast_message_id):
)
@main.route('/services/<uuid:service_id>/broadcast/<uuid:broadcast_message_id>')
@user_has_permissions('send_messages')
@service_has_permission('broadcast')
def view_broadcast_message(service_id, broadcast_message_id):
broadcast_message = BroadcastMessage.from_id(
broadcast_message_id,
service_id=current_service.id,
)
if broadcast_message.status == 'draft':
abort(404)
return render_template(
'views/broadcast/view-message.html',
broadcast_message=broadcast_message,
)
@main.route('/services/<uuid:service_id>/broadcast/<uuid:broadcast_message_id>/cancel')
@user_has_permissions('send_messages')
@service_has_permission('broadcast')