I wan't to get all the posts from a topic when I enter the topic, that's why I'm using 'filter:post.getPosts' filter to push the posts to getPosts method.
In the getPosts method, I filter the posts that I want the user to see: their own posts and the posts that other people reply him. So, let's say that I ended up with 4 posts from the original 10 posts.
I can just use that data, but the "X Reply" counter in the posts is determinated by the 'filter:topics.getPostReplies' filter, so I need to filter the replies too. So I need to first get all the replies, and then filter them. I'm going to get all the replies with that hook using getReplies method.
I want to pass the data returned by getPosts method to the getReplies method. That way I can using the posts I want to show to filter all the replies. The problem is that, If I invoke the getReplies method, the posts data that I pass, will be override with the replies that the hook pass it.
I'm running out of ideas, like using getPostsByPids inside getReplies, but that way it gets to an infinite loop in the console, because i'm using filter:post.getPosts hook to filter the posts.
The solution I found is passing the filtered posts to a global variable, an then using that variable in getReplies to filter the replies; but I think it can give memory leak problems.
Thanks for helping me.