Fix following groups
This commit is contained in:
@@ -286,13 +286,17 @@ userDB = (DB) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DB.getFollowingGroups = async (profileid) => {
|
DB.getFollowingGroups = async (profileid) => {
|
||||||
const profile = await DB.getProfile(profileId);
|
const profile = await DB.getProfile(profileid);
|
||||||
let ids = [];
|
let ids = [];
|
||||||
for(id in profile.following){
|
for(id in profile.following){
|
||||||
let oId = DB.ObjectID(id);
|
try{
|
||||||
let checkProfile = await DB.getProfileCache(oId)
|
let oId = DB.ObjectID(profile.following[id]);
|
||||||
if(checkProfile && checkProfile.isGroup && !checkProfile.isChat){
|
let checkProfile = await DB.getProfileCache(oId)
|
||||||
ids.push(oId)
|
if(checkProfile && checkProfile.isGroup && !checkProfile.isChat){
|
||||||
|
ids.push(oId)
|
||||||
|
}
|
||||||
|
}catch{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let query = {
|
let query = {
|
||||||
|
|||||||
@@ -96,7 +96,8 @@ DB.getDB.then((DB)=>{
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.get("/groups/following", async (req, res) => {
|
router.get("/groups/following", async (req, res) => {
|
||||||
let groups = await DB.getFollowingGroups();
|
const profileId = getProfileId(req);
|
||||||
|
let groups = await DB.getFollowingGroups(profileId);
|
||||||
return res.json({
|
return res.json({
|
||||||
status: "ok",
|
status: "ok",
|
||||||
groups
|
groups
|
||||||
|
|||||||
Reference in New Issue
Block a user