refactor: deprecate socket method posts.getPidIndex

This commit is contained in:
Julian Lam
2023-04-13 16:23:26 -04:00
parent d814e281a0
commit ee9f53f1ff
7 changed files with 71 additions and 32 deletions

View File

@@ -41,6 +41,16 @@ postsAPI.get = async function (caller, data) {
return post;
};
postsAPI.getIndex = async (caller, { pid, sort }) => {
const tid = await posts.getPostField(pid, 'tid');
const topicPrivileges = await privileges.topics.get(tid, caller.uid);
if (!topicPrivileges.read || !topicPrivileges['topics:read']) {
return null;
}
return await posts.getPidIndex(pid, tid, sort);
};
postsAPI.getSummary = async (caller, { pid }) => {
const tid = await posts.getPostField(pid, 'tid');
const topicPrivileges = await privileges.topics.get(tid, caller.uid);