mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-06 04:21:17 +01:00
feat: allow callers to parse topic teasers
in different types
This commit is contained in:
@@ -17,9 +17,11 @@ module.exports = function (Topics) {
|
||||
}
|
||||
let uid = options;
|
||||
let { teaserPost } = meta.config;
|
||||
let teaserParseType = 'plaintext';
|
||||
if (typeof options === 'object') {
|
||||
uid = options.uid;
|
||||
teaserPost = options.teaserPost || meta.config.teaserPost;
|
||||
teaserParseType = options.teaserParseType || 'plaintext';
|
||||
}
|
||||
|
||||
const counts = [];
|
||||
@@ -68,7 +70,7 @@ module.exports = function (Topics) {
|
||||
post.timestampISO = utils.toISOString(post.timestamp);
|
||||
tidToPost[post.tid] = post;
|
||||
});
|
||||
await Promise.all(postData.map(p => posts.parsePost(p, 'plaintext')));
|
||||
await Promise.all(postData.map(p => posts.parsePost(p, teaserParseType)));
|
||||
|
||||
const teasers = topics.map((topic, index) => {
|
||||
if (!topic) {
|
||||
|
||||
Reference in New Issue
Block a user