Notification New Group
This commit is contained in:
@@ -327,21 +327,12 @@ router.post('/settable', authenticate, async (req, res) => {
|
||||
}
|
||||
|
||||
// tools.mylog('rec', rec);
|
||||
}).then((myrec) => {
|
||||
|
||||
if (params.table === shared_consts.TAB_MYGROUPS && isnewrec) {
|
||||
// nuovo Record:
|
||||
// aggiungi il creatore al gruppo stesso
|
||||
return User.setGroupsCmd(mydata.idapp, req.user.username,
|
||||
myrec.groupname,
|
||||
shared_consts.GROUPSCMD.SETGROUP, true, req.user.username).then((ris) => {
|
||||
return res.send(myrec);
|
||||
});
|
||||
}
|
||||
}).then(async (myrec) => {
|
||||
|
||||
let setnotif = false;
|
||||
let typedir = 0;
|
||||
let typeid = 0;
|
||||
let groupNameDest = '';
|
||||
|
||||
if (shared_consts.TABLES_ADV_NOTIFICATION.includes(params.table)) {
|
||||
typedir = shared_consts.TypeNotifs.TYPEDIR_BACHECA;
|
||||
@@ -358,13 +349,25 @@ router.post('/settable', authenticate, async (req, res) => {
|
||||
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) {
|
||||
SendNotif.createNewNotification(req, res, params.table, myrec, typedir, typeid);
|
||||
await SendNotif.createNewNotification(req, res, {groupNameDest}, params.table, myrec, typedir, typeid);
|
||||
}
|
||||
|
||||
if (params.table === shared_consts.TAB_MYGROUPS && isnewrec) {
|
||||
// nuovo Record:
|
||||
// aggiungi il creatore al gruppo stesso
|
||||
return User.setGroupsCmd(mydata.idapp, req.user.username,
|
||||
myrec.groupname,
|
||||
shared_consts.GROUPSCMD.SETGROUP, true, req.user.username).then((ris) => {
|
||||
return res.send(myrec);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return res.send(myrec);
|
||||
}).catch((e) => {
|
||||
console.error('settable', e.message);
|
||||
|
||||
Reference in New Issue
Block a user