From 2d04b7c418fa252baa8908d14d3bec08e645f329 Mon Sep 17 00:00:00 2001 From: Joscha Henningsen Date: Wed, 26 Jul 2023 08:04:30 +0200 Subject: [PATCH] allow html in notification on old start page --- model/server-notification.go | 5 +++++ web/template/index.gohtml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/model/server-notification.go b/model/server-notification.go index 2f73ab2b4..901871257 100644 --- a/model/server-notification.go +++ b/model/server-notification.go @@ -3,6 +3,7 @@ package model import ( "errors" "gorm.io/gorm" + "html/template" "time" ) @@ -30,3 +31,7 @@ func (s ServerNotification) FormatFrom() string { func (s ServerNotification) FormatExpires() string { return s.Expires.Format("2006-01-02 15:04") } + +func (s ServerNotification) HTML() template.HTML { + return template.HTML(s.Text) +} diff --git a/web/template/index.gohtml b/web/template/index.gohtml index 6801677b3..2230b4b9f 100644 --- a/web/template/index.gohtml +++ b/web/template/index.gohtml @@ -15,7 +15,7 @@ {{if .ServerNotifications}} {{range $notification := .ServerNotifications}}

{{$notification.Text}}

+ class="fas fa-exclamation-triangle mr-2">{{$notification.HTML}}

{{end}} {{end}} {{if not .TUMLiveContext.User}}