Hello,
I'm using I wrote this to get all the posts from a Topic...
const topicData = {
posts: posts.posts,
category: topic[0].cid,
cid: topic[0].cid,
tid: topic[0].tid,
mainPid: topic[0].mainPid,
};
const topicWithPosts = await Topic.getTopicWithPosts(
topicData,
undefined,
posts.uid
);
But i'm getting this...
{
posts: [],
category: {
bgColor: '#fda34b',
cid: 1,
class: 'col-md-3 col-xs-6',
color: '#fff',
description: 'Announcements regarding our community',
descriptionParsed: '<p>Announcements regarding our community</p>\n',
disabled: 0,
icon: 'fa-bullhorn',
imageClass: 'cover',
isSection: 0,
link: '',
name: 'Announcements',
numRecentReplies: 1,
order: 1,
parentCid: 0,
post_count: 30,
slug: '1/announcements',
topic_count: 4,
minTags: 0,
maxTags: 5,
totalPostCount: 30,
totalTopicCount: 4
},
cid: 1,
tid: 6,
mainPid: 37,
tags: [],
tagWhitelist: [],
minTags: 0,
maxTags: 5,
thread_tools: [],
isFollowing: false,
isNotFollowing: true,
isIgnoring: false,
bookmark: null,
postSharing: [],
deleter: null,
merger: null,
related: [],
unreplied: false,
icons: []
}
I just want to get all the posts from that topic when a person clics to see the replies from a post. Nodebb gives me the replies from that specific post, but I want to get all the posts from that specific topic.
You can see that the posts array are empty. For your information, i'm using filter:post.getPosts hook and
const topic = await Topic.getTopicsByTids([posts.posts[0].tid], posts.uid) method before the Topic.getTopicWithPosts() method to get the topic info I needed to pass in.
Thanks.