temporary fix invalid ids
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user