Created
October 24, 2014 15:29
-
-
Save andrewrk/6f23e904b7865f4e5341 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/client/app.js b/src/client/app.js | |
index f5453f7..88ee9ed 100644 | |
--- a/src/client/app.js | |
+++ b/src/client/app.js | |
@@ -2832,7 +2832,9 @@ function renderEvents() { | |
function getEventMessageHtml(ev) { | |
var fn = eventTypeMessageFns[ev.type]; | |
if (!fn) throw new Error("Unknown event type: " + ev.type); | |
- return fn(ev); | |
+ var flags = {safe: false}; | |
+ var text = fn(ev, flags); | |
+ return flags.safe ? text : escapeHtml(text); | |
} | |
function linkify(text) { | |
@@ -2856,7 +2858,8 @@ var eventTypeMessageFns = { | |
autoPause: function(ev) { | |
return "auto pause because nobody is listening"; | |
}, | |
- chat: function(ev) { | |
+ chat: function(ev, flags) { | |
+ flags.safe = true; | |
return linkify(escapeHtml(ev.text)); | |
}, | |
'chat-me': function(ev) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment