Prefer cap_event to reference when referring to an alert

`reference` isn’t very human-friendly – the Environment Agency just
supply a UUID in this field.

The Environment Agency also populate the `<event>`` field with some
human readable text, for example:

> 013 Issue Severe Flood Warning EA

(013 is an ‘area code’ which will be meaningful to the Flood Warning Service team)

This commit changes the frontend to display the value of the `cap_event`
field, if it’s present, which is where the API stores the value of the
`<event>` field from the original CAP XML.

***

Depends on:
- [x] https://github.com/alphagov/notifications-api/pull/3344/files
This commit is contained in:
Chris Hill-Scott
2021-10-20 18:13:39 +01:00
parent 673d6debbe
commit 1334538cad
3 changed files with 33 additions and 7 deletions

View File

@@ -162,7 +162,7 @@ class BroadcastMessage(JSONModel):
def reference(self):
if self.template_id:
return self._dict['template_name']
return self._dict['reference']
return self._dict['cap_event'] or self._dict['reference']
@property
def template(self):