News post emails

This commit is contained in:
aeroreyna
2022-02-27 11:04:10 -08:00
parent 3d9393c0b2
commit 57a91c0470
5 changed files with 86 additions and 14 deletions

View File

@@ -167,7 +167,7 @@ postDB = (DB)=>{
$in: ids
}}
],
nonOrganicType: null
nonOrganicType: null // Exlcude news
};
return DB.postCols.find(query).sort({lastUpdated: -1}).limit(20).toArray().then(async (posts)=>{
return await filterPrivateGroups(posts, profile);

View File

@@ -40,13 +40,17 @@ userDB = (DB) => {
DB.getProfile = async (profileId) => {
//if (userProfileCache[profileId] && !userProfileCache[profileId].isGroup) return userProfileCache[profileId];
if(!profileId) return false;
const _id = DB.ObjectID(profileId);
let r = await DB.profileCols.findOne({ _id }).catch((err) => {
console.log(err);
return false;
});
if (r) userProfileCache[profileId] = r;
return r;
try{
const _id = DB.ObjectID(profileId);
let r = await DB.profileCols.findOne({ _id }).catch((err) => {
console.log(err);
return false;
});
if (r) userProfileCache[profileId] = r;
return r;
}catch(_){
return {};
}
}
DB.getPopularProfiles = async (limit = 10) => {