From 8f8945d418de2b7dda243a70c50e15090abcabe6 Mon Sep 17 00:00:00 2001 From: Nicholas Fogal Date: Sun, 19 Mar 2023 08:23:37 -0400 Subject: [PATCH] Issue#3064 html alert title message (#3065) Fixes [#3064](https://github.com/MichMich/MagicMirror/issues/3064) - Fixes default alert module nunjucks templates to render HTML by default unless 'titleType' and 'messageType' are set to 'text' in the payload data e.g. Display Text: `this.sendNotification('SHOW_ALERT', {type: "notification", title: "YoLink LeakSensor", titleType: "text", message: "" + deviceName + " reported an alarm that needs attention.", messageType: "text"});` Display HTML: `this.sendNotification('SHOW_ALERT', {type: "notification", title: "YoLink LeakSensor", message: "" + deviceName + " reported an alarm that needs attention."});` --- CHANGELOG.md | 1 + modules/default/alert/templates/alert.njk | 4 ++-- modules/default/alert/templates/notification.njk | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0e9305a..8b1cff82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ _This release is scheduled to be released on 2023-04-01._ - Fix wrong vertical alignment of calendar title column when wrapEvents is true (#3053) - Fix empty news feed stopping the reload forever - Fix e2e tests (failed after async changes) by running calendar and newsfeed tests last +- Fix default alert module to render HTML for title and message ## [2.22.0] - 2023-01-01 diff --git a/modules/default/alert/templates/alert.njk b/modules/default/alert/templates/alert.njk index 0a49df8a..7349a7ae 100644 --- a/modules/default/alert/templates/alert.njk +++ b/modules/default/alert/templates/alert.njk @@ -8,11 +8,11 @@
{% endif %} {% if title %} - {{ title }} + {{ title if titleType == 'text' else title | safe }} {% endif %} {% if message %} {% if title %}
{% endif %} - {{ message | safe }} + {{ message if messageType == 'text' else message | safe }} {% endif %} diff --git a/modules/default/alert/templates/notification.njk b/modules/default/alert/templates/notification.njk index af3adf26..1594ad48 100644 --- a/modules/default/alert/templates/notification.njk +++ b/modules/default/alert/templates/notification.njk @@ -1,9 +1,9 @@ {% if title %} - {{ title }} + {{ title if titleType == 'text' else title | safe }} {% endif %} {% if message %} {% if title %}
{% endif %} - {{ message | safe }} + {{ message if messageType == 'text' else message | safe }} {% endif %}