chore: minor cleanup

This commit is contained in:
Julian Lam
2024-04-16 13:38:05 -04:00
parent 407dda78e1
commit 1253ded7d5
2 changed files with 1 additions and 4 deletions

View File

@@ -74,8 +74,8 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
mainPid = utils.isNumber(mainPid) ? parseInt(mainPid, 10) : mainPid; mainPid = utils.isNumber(mainPid) ? parseInt(mainPid, 10) : mainPid;
// Relation & privilege check for local categories // Relation & privilege check for local categories
const privilege = `topics:${tid ? 'reply' : 'create'}`;
const hasRelation = options.skipChecks || hasTid || await assertRelation(chain[0]); const hasRelation = options.skipChecks || hasTid || await assertRelation(chain[0]);
const privilege = `topics:${tid ? 'reply' : 'create'}`;
const allowed = await privileges.categories.can(privilege, cid, activitypub._constants.uid); const allowed = await privileges.categories.can(privilege, cid, activitypub._constants.uid);
if (!hasRelation || !allowed) { if (!hasRelation || !allowed) {
if (!hasRelation) { if (!hasRelation) {

View File

@@ -47,9 +47,6 @@ Posts.getPostsByPids = async function (pids, uid) {
return []; return [];
} }
// todo: remove if not needed (and if this is still commented out after March 2024, then it wasn't needed)
// const remotePids = pids.filter(pid => !utils.isNumber(pid));
// await activitypub.notes.assert(uid, remotePids);
let posts = await Posts.getPostsData(pids); let posts = await Posts.getPostsData(pids);
posts = await Promise.all(posts.map(Posts.parsePost)); posts = await Promise.all(posts.map(Posts.parsePost));
const data = await plugins.hooks.fire('filter:post.getPosts', { posts: posts, uid: uid }); const data = await plugins.hooks.fire('filter:post.getPosts', { posts: posts, uid: uid });