Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

hotspots: Generate properly escaped HTML.

Anders Kaseorg56d0d30387b2
diff --git a/static/js/hotspots.js b/static/js/hotspots.js
index ad248cae50f..d96d75eeb66 100644
--- a/static/js/hotspots.js
+++ b/static/js/hotspots.js
@@ -2,6 +2,7 @@
const _ = require("lodash");
+const render_hotspot_icon = require("../templates/hotspot_icon.hbs");
const render_hotspot_overlay = require("../templates/hotspot_overlay.hbs");
const render_intro_reply_hotspot = require("../templates/intro_reply_hotspot.hbs");
@@ -220,14 +221,9 @@ function insert_hotspot_into_DOM(hotspot) {
img: WHALE,
});
- const hotspot_icon_HTML =
- '<div class="hotspot-icon" id="hotspot_' +
- hotspot.name +
- '_icon">' +
- '<span class="dot"></span>' +
- '<span class="pulse"></span>' +
- '<div class="bounce"><span class="bounce-icon">?</span></div>' +
- "</div>";
+ const hotspot_icon_HTML = render_hotspot_icon({
+ name: hotspot.name,
+ });
setTimeout(() => {
$("body").prepend(hotspot_icon_HTML);
diff --git a/static/templates/hotspot_icon.hbs b/static/templates/hotspot_icon.hbs
new file mode 100644
index 00000000000..87deca5e52a
--- /dev/null
+++ b/static/templates/hotspot_icon.hbs
@@ -0,0 +1,5 @@
+<div class="hotspot-icon" id="hotspot_{{name}}_icon">
+ <span class="dot"></span>
+ <span class="pulse"></span>
+ <div class="bounce"><span class="bounce-icon">?</span></div>
+</div>