mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Serialise content in broadcast message response
This will let us show the content of the broadcast message in places we can’t at the moment.
This commit is contained in:
@@ -2242,6 +2242,12 @@ class BroadcastMessage(db.Model):
|
||||
approved_by = db.relationship('User', foreign_keys=[approved_by_id])
|
||||
cancelled_by = db.relationship('User', foreign_keys=[cancelled_by_id])
|
||||
|
||||
@property
|
||||
def content(self):
|
||||
return self.template._as_utils_template_with_personalisation(
|
||||
self.personalisation
|
||||
).content_with_placeholders_filled_in
|
||||
|
||||
@property
|
||||
def personalisation(self):
|
||||
if self._personalisation:
|
||||
@@ -2261,6 +2267,7 @@ class BroadcastMessage(db.Model):
|
||||
'template_id': str(self.template_id),
|
||||
'template_version': self.template_version,
|
||||
'template_name': self.template.name,
|
||||
'template_content': self.content,
|
||||
|
||||
'personalisation': self.personalisation,
|
||||
'areas': self.areas.get("areas", []),
|
||||
|
||||
Reference in New Issue
Block a user