diff --git a/dbTools/post.js b/dbTools/post.js index ca43a4e..18f60be 100644 --- a/dbTools/post.js +++ b/dbTools/post.js @@ -111,7 +111,7 @@ postDB = (DB)=>{ DB.getPosts = async (profileId, viewerProfileId) => { const profile = await DB.getProfile(viewerProfileId); let query = {}; - if(profileId) { + if(profileId && DB.ObjectID.isValid(profileId)) { const id = DB.ObjectID(profileId); query = { $or: [ @@ -119,6 +119,8 @@ postDB = (DB)=>{ {toProfile: id} ] }; + } else { + if(profileId) return []; } return DB.postCols.find(query).sort({_id: -1}).limit(20).toArray().then(async (posts)=>{ return await filterPrivateGroups(posts, profile);