Skip to content

The default 'alert' module no longer displays rendered HTML data for 'title' or 'message' parameters #3064

@nfogal

Description

@nfogal

I found a bug in MagicMirror

Platform:

  • Raspberry Pi 4 8GB
  • Raspbian GNU/Linux 11 (bullseye)
  • Mozilla/5.0 Chrome/108.0.5359.62
  • Electron/22.0.0

Node Version: 18.15.0

MagicMirror² Version: 2.22.0

Description: The default 'alert' module and documentation (https://docs.magicmirror.builders/modules/alert.html) state that 'title' and 'message' parameters can contain either 'text' or 'html' data. However, when either 'title' or 'message' contain HTML, the HTML tags are displayed as text strings and they are not rendered. This issue was also brought to attention on the forum post at: https://forum.magicmirror.builders/topic/16336/alert-module-no-longer-accepts-html-for-notifications?_=1678593148680

Steps to Reproduce:

From any module, broadcast a notification / alert that contains HTML data in either the 'title' or 'message' parameters such as:

self.sendNotification("SHOW_ALERT", {title: '<u>Welcome</u>', message: '<b>Hello, Nick</b>'});

or

self.sendNotification('SHOW_ALERT', {type: 'notification', title: '<u>Welcome</u>', message: '<b>Hello, Nick</b>'});

Expected Results: The 'alert' module should display rendered HTML for both 'title' and / or 'message' parameters

Actual Results: Both 'text' and 'message' parameters are rendered as text strings (e.g. "Welcome" does not show an underlined title and "Hello, Nick" does not show the text as bold. Instead, each display the HTML tags to the interface as strings)

Configuration:

Additional Notes: This was more than likely caused by the updates to use nunjucks templates over straight HTML as stated in the forum post. I have a fix already in progress that I'll be pushing up shortly to the repo.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions