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:
"<u>YoLink LeakSensor</u>", titleType: "text", message: "<b>" +
deviceName + "</b> reported an alarm that needs attention.",
messageType: "text"});`

Display HTML:
`this.sendNotification('SHOW_ALERT', {type: "notification", title:
"<u>YoLink LeakSensor</u>", message: "<b>" + deviceName + "</b> reported
an alarm that needs attention."});`
This commit is contained in:
Nicholas Fogal 2023-03-19 08:23:37 -04:00 committed by GitHub
parent 6d779235cf
commit 8f8945d418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -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 wrong vertical alignment of calendar title column when wrapEvents is true (#3053)
- Fix empty news feed stopping the reload forever - Fix empty news feed stopping the reload forever
- Fix e2e tests (failed after async changes) by running calendar and newsfeed tests last - 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 ## [2.22.0] - 2023-01-01

View File

@ -8,11 +8,11 @@
<br/> <br/>
{% endif %} {% endif %}
{% if title %} {% if title %}
<span class="thin dimmed medium">{{ title }}</span> <span class="thin dimmed medium">{{ title if titleType == 'text' else title | safe }}</span>
{% endif %} {% endif %}
{% if message %} {% if message %}
{% if title %} {% if title %}
<br/> <br/>
{% endif %} {% endif %}
<span class="light bright small">{{ message | safe }}</span> <span class="light bright small">{{ message if messageType == 'text' else message | safe }}</span>
{% endif %} {% endif %}

View File

@ -1,9 +1,9 @@
{% if title %} {% if title %}
<span class="thin dimmed medium">{{ title }}</span> <span class="thin dimmed medium">{{ title if titleType == 'text' else title | safe }}</span>
{% endif %} {% endif %}
{% if message %} {% if message %}
{% if title %} {% if title %}
<br/> <br/>
{% endif %} {% endif %}
<span class="light bright small">{{ message | safe }}</span> <span class="light bright small">{{ message if messageType == 'text' else message | safe }}</span>
{% endif %} {% endif %}