diff --git a/app/assets/javascripts/discourse/controllers/notification.js.es6 b/app/assets/javascripts/discourse/controllers/notification.js.es6 index dc23b69362b..eaf9d83540c 100644 --- a/app/assets/javascripts/discourse/controllers/notification.js.es6 +++ b/app/assets/javascripts/discourse/controllers/notification.js.es6 @@ -7,14 +7,27 @@ export default Discourse.ObjectController.extend({ return this.get("data.display_username"); }.property(), - link: function() { - if (this.get('data.badge_id')) { - return '' + this.get('data.badge_name') + ''; + safe: function(prop){ + var val = this.get(prop); + if(val) { + val = Handlebars.Utils.escapeExpression(val); } + return val; + }, + + link: function() { + + var badgeId = this.safe('data.badge_id'); + if (badgeId) { + var badgeName = this.safe('data.badge_name'); + return '' + badgeName + ''; + } + if (this.blank("data.topic_title")) { return ""; } - var url = Discourse.Utilities.postUrl(this.get("slug"), this.get("topic_id"), this.get("post_number")); - return '' + this.get("data.topic_title") + ''; + + var url = Discourse.Utilities.postUrl(this.safe("slug"), this.safe("topic_id"), this.safe("post_number")); + return '' + this.safe("data.topic_title") + ''; }.property() });