temporary fix invalid ids
This commit is contained in:
@@ -111,7 +111,7 @@ postDB = (DB)=>{
|
|||||||
DB.getPosts = async (profileId, viewerProfileId) => {
|
DB.getPosts = async (profileId, viewerProfileId) => {
|
||||||
const profile = await DB.getProfile(viewerProfileId);
|
const profile = await DB.getProfile(viewerProfileId);
|
||||||
let query = {};
|
let query = {};
|
||||||
if(profileId) {
|
if(profileId && DB.ObjectID.isValid(profileId)) {
|
||||||
const id = DB.ObjectID(profileId);
|
const id = DB.ObjectID(profileId);
|
||||||
query = {
|
query = {
|
||||||
$or: [
|
$or: [
|
||||||
@@ -119,6 +119,8 @@ postDB = (DB)=>{
|
|||||||
{toProfile: id}
|
{toProfile: id}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
if(profileId) return [];
|
||||||
}
|
}
|
||||||
return DB.postCols.find(query).sort({_id: -1}).limit(20).toArray().then(async (posts)=>{
|
return DB.postCols.find(query).sort({_id: -1}).limit(20).toArray().then(async (posts)=>{
|
||||||
return await filterPrivateGroups(posts, profile);
|
return await filterPrivateGroups(posts, profile);
|
||||||
|
|||||||
Reference in New Issue
Block a user