mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-06-17 00:21:30 +02:00
fix: post indices if there is a blocked user in topic
This commit is contained in:
@@ -45,8 +45,7 @@ Posts.getPostsByPids = async function (pids, uid) {
|
||||
return [];
|
||||
}
|
||||
let posts = await Posts.getPostsData(pids);
|
||||
posts = await Promise.all(posts.map(p => Posts.parsePost(p)));
|
||||
posts = await user.blocks.filter(uid, posts);
|
||||
posts = await Promise.all(posts.map(Posts.parsePost));
|
||||
const data = await plugins.hooks.fire('filter:post.getPosts', { posts: posts, uid: uid });
|
||||
if (!data || !Array.isArray(data.posts)) {
|
||||
return [];
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
'use strict';
|
||||
|
||||
const topics = require('../topics');
|
||||
const user = require('../user');
|
||||
const utils = require('../utils');
|
||||
|
||||
module.exports = function (Posts) {
|
||||
Posts.getPostsFromSet = async function (set, start, stop, uid, reverse) {
|
||||
const pids = await Posts.getPidsFromSet(set, start, stop, reverse);
|
||||
return await Posts.getPostsByPids(pids, uid);
|
||||
const posts = await Posts.getPostsByPids(pids, uid);
|
||||
return await user.blocks.filter(uid, posts);
|
||||
};
|
||||
|
||||
Posts.isMain = async function (pids) {
|
||||
|
||||
Reference in New Issue
Block a user