Skip to content

Node.js based forum software built for the modern web

added new hook for messaging teaser retrieval, and casting input as String before execuring stripTags templates helper

Julian Lam05c724de30ef
diff --git a/public/src/modules/helpers.js b/public/src/modules/helpers.js
index a913da80b7..3035d29fc4 100644
--- a/public/src/modules/helpers.js
+++ b/public/src/modules/helpers.js
@@ -69,10 +69,10 @@
helpers.stripTags = function (str) {
if (typeof S !== 'undefined') {
- return S(str).stripTags().s;
+ return S(String(str)).stripTags().s;
} else {
var S = require('string');
- return S(str).stripTags().s;
+ return S(String(str)).stripTags().s;
}
};
diff --git a/src/messaging.js b/src/messaging.js
index 5bb668ae6e..a37503e3e3 100644
--- a/src/messaging.js
+++ b/src/messaging.js
@@ -210,7 +210,9 @@ Messaging.getTeaser = function (uid, roomId, callback) {
},
function (user, next) {
teaser.user = user;
- next(null, teaser);
+ plugins.fireHook('filter:messaging.getTeaser', { teaser: teaser }, function (err, data) {
+ next(err, data.teaser);
+ });
}
], callback);
};