Add (in Alert module) templateName parameter (#3009)

This simple change allows to use your own templates (under "templates"
directory). The parameter `templateName` is optional (ignored on falsy
value - undefined, null, empty string, etc.) and independent of `type`.

Co-authored-by: Veeck <github@veeck.de>
This commit is contained in:
Piotr Rajnisz
2023-01-26 13:00:49 +01:00
committed by GitHub
parent f6dcfb5ca3
commit 7198ae5eae
2 changed files with 3 additions and 2 deletions

View File

@@ -69,7 +69,7 @@ Module.register("alert", {
},
async showNotification(notification) {
const message = await this.renderMessage("notification", notification);
const message = await this.renderMessage(notification.templateName || "notification", notification);
new NotificationFx({
message,
@@ -90,7 +90,7 @@ Module.register("alert", {
this.toggleBlur(true);
}
const message = await this.renderMessage("alert", alert);
const message = await this.renderMessage(alert.templateName || "alert", alert);
// Store alert in this.alerts
this.alerts[sender.name] = new NotificationFx({