diff --git a/openwisp_notifications/api/serializers.py b/openwisp_notifications/api/serializers.py index c5060a42..2f843a2d 100644 --- a/openwisp_notifications/api/serializers.py +++ b/openwisp_notifications/api/serializers.py @@ -59,7 +59,7 @@ class Meta(NotificationSerializer.Meta): fields = [ 'id', 'message', - 'description', + 'get_description', 'unread', 'target_url', 'email_subject', diff --git a/openwisp_notifications/base/models.py b/openwisp_notifications/base/models.py index 8b5fb871..82e346a8 100644 --- a/openwisp_notifications/base/models.py +++ b/openwisp_notifications/base/models.py @@ -105,6 +105,10 @@ def target_url(self): def message(self): return self.get_message() + @cached_property + def get_description(self): + return mark_safe(markdown(self.description)) + @property def email_message(self): return self.get_message(email_message=True) diff --git a/openwisp_notifications/static/openwisp-notifications/js/notifications.js b/openwisp_notifications/static/openwisp-notifications/js/notifications.js index 0c5e05d4..515ca078 100644 --- a/openwisp_notifications/static/openwisp-notifications/js/notifications.js +++ b/openwisp_notifications/static/openwisp-notifications/js/notifications.js @@ -233,7 +233,7 @@ function notificationWidget($) {