Creare Visualizzazione Nuova della scheda della MySkill (Bacheca)
This commit is contained in:
@@ -1417,7 +1417,7 @@ UserSchema.statics.setFriendsCmd = async function(
|
|||||||
}
|
}
|
||||||
if (ris) {
|
if (ris) {
|
||||||
// Invia una notifica alla persona
|
// Invia una notifica alla persona
|
||||||
tools.sendNotificationByUsername(idapp, usernameDest, cmd, true);
|
tools.sendNotificationByUsername(idapp, usernameDest, cmd, true, usernameOrig);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (foundIfAlreadyAskFriend) {
|
if (foundIfAlreadyAskFriend) {
|
||||||
|
|||||||
@@ -192,7 +192,8 @@ router.post('/', async (req, res) => {
|
|||||||
|
|
||||||
recuser = await User.findByCellAndNameSurname(user.idapp, user.profile.cell,
|
recuser = await User.findByCellAndNameSurname(user.idapp, user.profile.cell,
|
||||||
user.name, user.surname);
|
user.name, user.surname);
|
||||||
if (recuser && user.name !== '' && user.surname !== '' && user.profile.cell !== '') {
|
if (recuser && user.name !== '' && user.surname !== '' &&
|
||||||
|
user.profile.cell !== '') {
|
||||||
console.log('UTENTE GIA ESISTENTE:\n');
|
console.log('UTENTE GIA ESISTENTE:\n');
|
||||||
console.log(user);
|
console.log(user);
|
||||||
// User already registered!
|
// User already registered!
|
||||||
@@ -211,16 +212,20 @@ router.post('/', async (req, res) => {
|
|||||||
// nomeaportador_corretto = recextra.aportador_solidario_originale_name_surname;
|
// nomeaportador_corretto = recextra.aportador_solidario_originale_name_surname;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
const id_aportador = await User.getIdByUsername(user.idapp,
|
||||||
|
user.aportador_solidario);
|
||||||
const id_aportador = await User.getIdByUsername(user.idapp, user.aportador_solidario);
|
|
||||||
|
|
||||||
if (!id_aportador && tools.getAskToVerifyReg(body.idapp)) {
|
if (!id_aportador && tools.getAskToVerifyReg(body.idapp)) {
|
||||||
// Si sta tentando di registrare una persona sotto che non corrisponde!
|
// Si sta tentando di registrare una persona sotto che non corrisponde!
|
||||||
let msg = 'Il link di registrazione non sembra risultare valido.<br>invitante: ' + user.aportador_solidario + '<br>username: ' + user.username;
|
let msg = 'Il link di registrazione non sembra risultare valido.<br>invitante: ' +
|
||||||
|
user.aportador_solidario + '<br>username: ' + user.username;
|
||||||
|
|
||||||
await telegrambot.sendMsgTelegramToTheManagers(user.idapp, msg);
|
await telegrambot.sendMsgTelegramToTheManagers(user.idapp, msg);
|
||||||
res.status(400).send({ code: server_constants.RIS_CODE_USER_APORTADOR_NOT_VALID, msg: '' });
|
res.status(400).
|
||||||
|
send({
|
||||||
|
code: server_constants.RIS_CODE_USER_APORTADOR_NOT_VALID,
|
||||||
|
msg: '',
|
||||||
|
});
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,8 +340,13 @@ router.post('/profile', authenticate, (req, res) => {
|
|||||||
|
|
||||||
//++Todo: controlla che tipo di dati ha il permesso di leggere
|
//++Todo: controlla che tipo di dati ha il permesso di leggere
|
||||||
|
|
||||||
return User.getUserProfileByUsername(idapp, username, req.user.username, false, req.user.perm).then((ris) => {
|
return User.getUserProfileByUsername(idapp, username, req.user.username, false, req.user.perm).
|
||||||
res.send(ris);
|
then((ris) => {
|
||||||
|
|
||||||
|
return User.getFriendsByUsername(idapp, req.user.username).then((friends) => {
|
||||||
|
res.send({user: ris, friends });
|
||||||
|
});
|
||||||
|
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
tools.mylog('ERRORE IN Profile: ' + e.message);
|
tools.mylog('ERRORE IN Profile: ' + e.message);
|
||||||
res.status(400).send();
|
res.status(400).send();
|
||||||
@@ -498,7 +508,6 @@ router.post('/groups', authenticate, (req, res) => {
|
|||||||
idapp = req.body.idapp;
|
idapp = req.body.idapp;
|
||||||
locale = req.body.locale;
|
locale = req.body.locale;
|
||||||
|
|
||||||
|
|
||||||
return MyGroup.getGroupsByUsername(idapp, username, req).then((ris) => {
|
return MyGroup.getGroupsByUsername(idapp, username, req).then((ris) => {
|
||||||
res.send(ris);
|
res.send(ris);
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
@@ -520,13 +529,16 @@ router.post('/friends/cmd', authenticate, (req, res) => {
|
|||||||
if (!User.isAdmin(req.user.perm) || !User.isManager(req.user.perm)) {
|
if (!User.isAdmin(req.user.perm) || !User.isManager(req.user.perm)) {
|
||||||
// If without permissions, exit
|
// If without permissions, exit
|
||||||
if (usernameOrig !== usernameLogged) {
|
if (usernameOrig !== usernameLogged) {
|
||||||
return res.status(404).send({code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: ''});
|
return res.status(404).
|
||||||
|
send({code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: ''});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return User.setFriendsCmd(idapp, usernameOrig, usernameDest, cmd, value).then((ris) => {
|
return User.setFriendsCmd(idapp, usernameOrig, usernameDest, cmd, value).
|
||||||
|
then((ris) => {
|
||||||
res.send(ris);
|
res.send(ris);
|
||||||
}).catch((e) => {
|
}).
|
||||||
|
catch((e) => {
|
||||||
tools.mylog('ERRORE IN Friends/cmd: ' + e.message);
|
tools.mylog('ERRORE IN Friends/cmd: ' + e.message);
|
||||||
res.status(400).send();
|
res.status(400).send();
|
||||||
});
|
});
|
||||||
@@ -545,13 +557,16 @@ router.post('/groups/cmd', authenticate, (req, res) => {
|
|||||||
if (!User.isAdmin(req.user.perm) || !User.isManager(req.user.perm)) {
|
if (!User.isAdmin(req.user.perm) || !User.isManager(req.user.perm)) {
|
||||||
// If without permissions, exit
|
// If without permissions, exit
|
||||||
if (usernameOrig !== usernameLogged) {
|
if (usernameOrig !== usernameLogged) {
|
||||||
return res.status(404).send({code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: ''});
|
return res.status(404).
|
||||||
|
send({code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: ''});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return User.setGroupsCmd(idapp, usernameOrig, groupnameDest, cmd, value).then((ris) => {
|
return User.setGroupsCmd(idapp, usernameOrig, groupnameDest, cmd, value).
|
||||||
|
then((ris) => {
|
||||||
res.send(ris);
|
res.send(ris);
|
||||||
}).catch((e) => {
|
}).
|
||||||
|
catch((e) => {
|
||||||
tools.mylog('ERRORE IN groups/cmd: ' + e.message);
|
tools.mylog('ERRORE IN groups/cmd: ' + e.message);
|
||||||
res.status(400).send();
|
res.status(400).send();
|
||||||
});
|
});
|
||||||
@@ -892,7 +907,7 @@ async function eseguiDbOp(idapp, mydata, locale) {
|
|||||||
await mytable.DuplicateAllRecords(idapporig, idappdest).
|
await mytable.DuplicateAllRecords(idapporig, idappdest).
|
||||||
then((numrec) => {
|
then((numrec) => {
|
||||||
// tools.mylogshow(' REC TO MODIFY: ', rec);
|
// tools.mylogshow(' REC TO MODIFY: ', rec);
|
||||||
numrectot += numrec
|
numrectot += numrec;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const tools = require('../tools/general');
|
|||||||
const appTelegram = [tools.FREEPLANET, tools.ISP];
|
const appTelegram = [tools.FREEPLANET, tools.ISP];
|
||||||
|
|
||||||
const appTelegram_TEST = [tools.FREEPLANET, tools.PDNM, tools.ISP];
|
const appTelegram_TEST = [tools.FREEPLANET, tools.PDNM, tools.ISP];
|
||||||
const appTelegram_DEVELOP = [tools.PDNM];
|
const appTelegram_DEVELOP = [tools.ISP];
|
||||||
|
|
||||||
const appTelegramFinti = ['2', tools.CNM];
|
const appTelegramFinti = ['2', tools.CNM];
|
||||||
const appTelegramDest = [tools.FREEPLANET, tools.FREEPLANET];
|
const appTelegramDest = [tools.FREEPLANET, tools.FREEPLANET];
|
||||||
|
|||||||
@@ -803,7 +803,7 @@ module.exports = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
sendNotificationByUsername: async function(idapp, username, cmd, telegram) {
|
sendNotificationByUsername: async function(idapp, username, cmd, telegram, usernameOrig) {
|
||||||
|
|
||||||
var {User} = require('../models/user');
|
var {User} = require('../models/user');
|
||||||
|
|
||||||
@@ -821,8 +821,8 @@ module.exports = {
|
|||||||
let actions = [];
|
let actions = [];
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
if (cmd === shared_consts.FRIENDSCMD.REQFRIEND) {
|
if (cmd === shared_consts.FRIENDSCMD.REQFRIEND) {
|
||||||
descr = printf(this.get__('RICHIESTA_AMICIZIA', lang), username);
|
descr = printf(this.get__('RICHIESTA_AMICIZIA', lang), usernameOrig);
|
||||||
openUrl = '/my/' + username;
|
openUrl = '/my/' + usernameOrig;
|
||||||
tag = 'reqfriends';
|
tag = 'reqfriends';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user