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

@@ -5,6 +5,7 @@ from notifications_utils.template import BroadcastPreviewTemplate
from orderedset import OrderedSet
from app.models import JSONModel, ModelList
from app.models.user import User
from app.notify_client.broadcast_message_api_client import (
broadcast_message_api_client,
)
@@ -94,6 +95,18 @@ class BroadcastMessage(JSONModel):
return 'completed'
return self._dict['status']
@property
def created_by(self):
return User.from_id(self.created_by_id)
@property
def approved_by(self):
return User.from_id(self.approved_by_id)
@property
def cancelled_by(self):
return User.from_id(self.cancelled_by_id)
def add_areas(self, *new_areas):
broadcast_message_api_client.update_broadcast_message(
broadcast_message_id=self.id,