Group Page : visibility, some info, members views.
This commit is contained in:
@@ -340,23 +340,29 @@ router.post('/settable', authenticate, async (req, res) => {
|
||||
let typeid = 0;
|
||||
let groupnameDest = '';
|
||||
|
||||
if (shared_consts.TABLES_ADV_NOTIFICATION.includes(params.table)) {
|
||||
typedir = shared_consts.TypeNotifs.TYPEDIR_BACHECA;
|
||||
typeid = (params.table === shared_consts.TABLES_MYGOODS) ? shared_consts.TypeNotifs.ID_BACHECA_NEW_GOOD : shared_consts.TypeNotifs.ID_BACHECA_NEW_SERVICE
|
||||
setnotif = true;
|
||||
}
|
||||
if (isnewrec) {
|
||||
// New Record created
|
||||
|
||||
if (shared_consts.TABLES_EVENTS_NOTIFICATION.includes(params.table)) {
|
||||
typedir = shared_consts.TypeNotifs.TYPEDIR_EVENTS;
|
||||
typeid = shared_consts.TypeNotifs.ID_EVENTS_NEW_REC;
|
||||
setnotif = true;
|
||||
}
|
||||
if (shared_consts.TABLES_ADV_NOTIFICATION.includes(params.table)) {
|
||||
typedir = shared_consts.TypeNotifs.TYPEDIR_BACHECA;
|
||||
typeid = (params.table === shared_consts.TABLES_MYGOODS)
|
||||
? shared_consts.TypeNotifs.ID_BACHECA_NEW_GOOD
|
||||
: shared_consts.TypeNotifs.ID_BACHECA_NEW_SERVICE
|
||||
setnotif = true;
|
||||
}
|
||||
|
||||
if (shared_consts.TABLES_GROUPS_NOTIFICATION.includes(params.table)) {
|
||||
typedir = shared_consts.TypeNotifs.TYPEDIR_GROUPS;
|
||||
typeid = shared_consts.TypeNotifs.ID_GROUP_NEW_REC;
|
||||
groupnameDest = myrec ? myrec.groupname : '';
|
||||
setnotif = true;
|
||||
if (shared_consts.TABLES_EVENTS_NOTIFICATION.includes(params.table)) {
|
||||
typedir = shared_consts.TypeNotifs.TYPEDIR_EVENTS;
|
||||
typeid = shared_consts.TypeNotifs.ID_EVENTS_NEW_REC;
|
||||
setnotif = true;
|
||||
}
|
||||
|
||||
if (shared_consts.TABLES_GROUPS_NOTIFICATION.includes(params.table)) {
|
||||
typedir = shared_consts.TypeNotifs.TYPEDIR_GROUPS;
|
||||
typeid = shared_consts.TypeNotifs.ID_GROUP_NEW_REC;
|
||||
groupnameDest = myrec ? myrec.groupname : '';
|
||||
setnotif = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (setnotif) {
|
||||
|
||||
@@ -44,6 +44,14 @@ router.post('/load', authenticate, async (req, res) => {
|
||||
const whatshow = MyGroup.getWhatToShow(idapp, req.user.username);
|
||||
let data = await MyGroup.findOne({idapp, groupname}, whatshow).lean();
|
||||
|
||||
let cities = [];
|
||||
if (data) {
|
||||
cities = await MyGroup.extractCitiesName(idapp, data._id);
|
||||
if (cities && cities.length > 0) {
|
||||
cities = cities[0].mycities;
|
||||
}
|
||||
}
|
||||
|
||||
data = await getGroupRecAdminsInfo(idapp, data);
|
||||
|
||||
const whatshowUsers = await User.getWhatToShow_IfFriends(idapp, req.user.username);
|
||||
@@ -56,9 +64,9 @@ router.post('/load', authenticate, async (req, res) => {
|
||||
},
|
||||
},
|
||||
whatshowUsers,
|
||||
);
|
||||
).lean();
|
||||
|
||||
res.send({mygroup: data, users_in_group});
|
||||
res.send({mygroup: data, users_in_group, cities});
|
||||
|
||||
} catch (e) {
|
||||
console.error('Error in MyGroups', e);
|
||||
|
||||
Reference in New Issue
Block a user