From 879b6afbc5d556cc466d0105dc85233a865876cf Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Sat, 28 Feb 2015 17:41:38 +0000 Subject: [PATCH] Display serverside HTML notifications correctly refs #4964 - persistent notifcations from the server contain HTML and should be marked HTML safe --- core/client/utils/notifications.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/core/client/utils/notifications.js b/core/client/utils/notifications.js index da6b8ec504..ee0801a101 100644 --- a/core/client/utils/notifications.js +++ b/core/client/utils/notifications.js @@ -25,8 +25,19 @@ var Notifications = Ember.ArrayProxy.extend({ this._super(object); }, handleNotification: function (message, delayed) { - if (!message.status) { - message.status = 'passive'; + if (typeof message.toJSON === 'function') { + // If this is a persistent message from the server, treat it as html safe + if (message.get('status') === 'persistent') { + message.set('message', message.get('message').htmlSafe()); + } + + if (!message.get('status')) { + message.set('status', 'passive'); + } + } else { + if (!message.status) { + message.status = 'passive'; + } } if (!delayed) {