Upvote and Bookmark on topic level
Unsolved
Technical Support
-
we have modified the UI to look like this. For this, we have to include mainPost data to the topic list file by the use of plugin : -**plugin.filterTopicsGet = async function (hookData) { try { if (!hookData || !hookData.topics) { return hookData; } const mainPids = hookData.topics.map(t => t.mainPid); if (mainPids.length) { const mainPosts = await posts.getPostsByPids(mainPids, hookData.uid); hookData.topics.forEach((topic, index) => { topic.mainPost = mainPosts[index]; }); } } catch (error) { console.error("Error in filterTopicsGet:", error); } return hookData; };**
It is working fine But now we have to add like, and bookmark functionality to the topic level on the recent page we need to get access to "upvoted" at the topic-list.tpl. How can we do that, do we need to create a plugin or just write a custom js to solve our problem. we have add this code to topic-list.tpl file : -
**<!-- IF !reputation:disabled --> <span class="votes"> <a component="post/upvote" href="#" class="<!-- IF posts.upvoted -->upvoted<!-- ENDIF posts.upvoted -->" style="padding: 0px;"> <i class="fa-regular fa-heart icons-topic" style="color: rgb(255, 1, 1);"></i> </a> <span component="post/vote-count" data-votes="{posts.votes}">{topics.votes}</span> </span> <!-- ENDIF !reputation:disabled -->**
Copyright © 2024 NodeBB | Contributors