Skip to content

Commit

Permalink
feat: new filter filter:teasers.configureStripTags
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Oct 21, 2020
1 parent 1a4c0de commit 177a961
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/topics/teaser.js
Expand Up @@ -12,8 +12,6 @@ var plugins = require('../plugins');
var utils = require('../utils');

module.exports = function (Topics) {
var stripTeaserTags = utils.stripTags.concat(['img']);

Topics.getTeasers = async function (topics, options) {
if (!Array.isArray(topics) || !topics.length) {
return [];
Expand Down Expand Up @@ -69,14 +67,16 @@ module.exports = function (Topics) {
});
await Promise.all(postData.map(p => posts.parsePost(p)));

const { tags } = await plugins.fireHook('filter:teasers.configureStripTags', { tags: utils.stripTags.concat(['img']) });

var teasers = topics.map(function (topic, index) {
if (!topic) {
return null;
}
if (tidToPost[topic.tid]) {
tidToPost[topic.tid].index = meta.config.teaserPost === 'first' ? 1 : counts[index];
if (tidToPost[topic.tid].content) {
tidToPost[topic.tid].content = utils.stripHTMLTags(tidToPost[topic.tid].content, stripTeaserTags);
tidToPost[topic.tid].content = utils.stripHTMLTags(tidToPost[topic.tid].content, tags);
}
}
return tidToPost[topic.tid];
Expand Down

0 comments on commit 177a961

Please sign in to comment.