strip img tags on topic teaser

v1.18.x
Barış Soner Uşaklı 7 years ago
parent e4ff1dc61b
commit a9e15ae9d0

@ -12,6 +12,8 @@ var plugins = require('../plugins');
var utils = require('../utils'); var utils = require('../utils');
module.exports = function (Topics) { module.exports = function (Topics) {
var stripTeaserTags = utils.stripTags.concat(['img']);
Topics.getTeasers = function (topics, uid, callback) { Topics.getTeasers = function (topics, uid, callback) {
if (typeof uid === 'function') { if (typeof uid === 'function') {
winston.warn('[Topics.getTeasers] this usage is deprecated please provide uid'); winston.warn('[Topics.getTeasers] this usage is deprecated please provide uid');
@ -90,7 +92,7 @@ module.exports = function (Topics) {
if (tidToPost[topic.tid]) { if (tidToPost[topic.tid]) {
tidToPost[topic.tid].index = meta.config.teaserPost === 'first' ? 1 : counts[index]; tidToPost[topic.tid].index = meta.config.teaserPost === 'first' ? 1 : counts[index];
if (tidToPost[topic.tid].content) { if (tidToPost[topic.tid].content) {
tidToPost[topic.tid].content = utils.stripHTMLTags(tidToPost[topic.tid].content, utils.stripTags); tidToPost[topic.tid].content = utils.stripHTMLTags(tidToPost[topic.tid].content, stripTeaserTags);
} }
} }
return tidToPost[topic.tid]; return tidToPost[topic.tid];

Loading…
Cancel
Save