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

This commit is contained in:
Julian Lam
2017-01-27 11:26:05 -05:00
parent c81c756e57
commit 05c724de30
2 changed files with 5 additions and 3 deletions

View File

@@ -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;
}
};

View File

@@ -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);
};