Fix permissions to private groups on tag posts q
This commit is contained in:
@@ -246,16 +246,22 @@ postDB = (DB)=>{
|
||||
});
|
||||
}
|
||||
|
||||
DB.getMediaTagPostOfUser = (profileId, mediaTag = "@image:", limit = 20) => {
|
||||
if(!DB.ObjectID.isValid(profileId)) return [];
|
||||
DB.getMediaTagPostOfUser = async (profileId, viewerProfileId, mediaTag = "@image:", limit = 30) => {
|
||||
if(!DB.ObjectID.isValid(profileId) || !DB.ObjectID.isValid(profileId)) return [];
|
||||
const profile = await DB.getProfile(viewerProfileId);
|
||||
let profileid = DB.ObjectID(profileId);
|
||||
let query = {
|
||||
profileid,
|
||||
$or: [
|
||||
{profileid: profileid},
|
||||
{toProfile: profileid}
|
||||
],
|
||||
content: {
|
||||
"$regex": mediaTag
|
||||
}
|
||||
}
|
||||
return DB.postCols.find(query).sort({_id: -1}).limit(limit).toArray().catch((err)=>{
|
||||
return DB.postCols.find(query).sort({_id: -1}).limit(limit).toArray().then(async (posts)=>{
|
||||
return await filterPrivateGroups(posts, profile);
|
||||
}).catch((err)=>{
|
||||
console.log(err);
|
||||
return false;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user