diff --git a/controllers/admin/chat.go b/controllers/admin/chat.go
index 656481b92..f9166ac0e 100644
--- a/controllers/admin/chat.go
+++ b/controllers/admin/chat.go
@@ -58,8 +58,7 @@ func GetChatMessages(w http.ResponseWriter, r *http.Request) {
}
}
-// SendSystemMessage will send an official "SYSTEM" message
-// to chat on behalf of your server.
+// SendSystemMessage will send an official "SYSTEM" message to chat on behalf of your server.
func SendSystemMessage(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
@@ -76,7 +75,7 @@ func SendSystemMessage(w http.ResponseWriter, r *http.Request) {
message.Visible = true
message.SetDefaults()
- message.RenderAndSanitizeMessageBody()
+ message.RenderBody()
if err := core.SendMessageToChat(message); err != nil {
controllers.BadRequestHandler(w, err)
@@ -137,6 +136,7 @@ func SendChatAction(w http.ResponseWriter, r *http.Request) {
}
message.SetDefaults()
+ message.RenderAndSanitizeMessageBody()
if err := core.SendMessageToChat(message); err != nil {
controllers.BadRequestHandler(w, err)
diff --git a/core/chat/client.go b/core/chat/client.go
index 5ecb5f8fc..2cb950339 100644
--- a/core/chat/client.go
+++ b/core/chat/client.go
@@ -222,6 +222,8 @@ func (c *Client) chatMessageReceived(data []byte) {
c.Username = &msg.Author
msg.ClientID = c.ClientID
+ msg.RenderAndSanitizeMessageBody()
+
_server.SendToAll(msg)
}
diff --git a/core/chat/messageRendering_test.go b/core/chat/messageRendering_test.go
index b0d320244..e5cf552f0 100644
--- a/core/chat/messageRendering_test.go
+++ b/core/chat/messageRendering_test.go
@@ -52,3 +52,14 @@ func TestAllowEmojiImages(t *testing.T) {
t.Errorf("message rendering/sanitation does not match expected. Got\n%s, \n\n want:\n%s", result, expected)
}
}
+
+// Test to verify we can pass raw html and render markdown.
+func TestAllowHTML(t *testing.T) {
+ messageContent := `
