- Gruppi (3) - lista degli utenti del gruppo
This commit is contained in:
@@ -344,4 +344,7 @@ Dom 16/01 ORE 22:09: [Inviato a Paolo Arena (paoloar77)]:
|
|||||||
Dom 16/01 ORE 22:11: [Inviato a Paolo Arena (paoloar77)]:
|
Dom 16/01 ORE 22:11: [Inviato a Paolo Arena (paoloar77)]:
|
||||||
🔥 Si è appena Registrato "Paoloar775 Paoloar775 (paoloar775)
|
🔥 Si è appena Registrato "Paoloar775 Paoloar775 (paoloar775)
|
||||||
Dom 16/01 ORE 22:14: [Inviato a Paolo Arena (paoloar77)]:
|
Dom 16/01 ORE 22:14: [Inviato a Paolo Arena (paoloar77)]:
|
||||||
🔥 Si è appena Registrato "Pao Are (paoloar775)
|
🔥 Si è appena Registrato "Pao Are (paoloar775)
|
||||||
|
Lun 07/02 ORE 22:48: [Inviato a undefined undefined (paoloar77)]:
|
||||||
|
🔥 Acaba de registrarse " (paoloar775) (n. %s)"
|
||||||
|
(Invitado de %s)
|
||||||
@@ -200,7 +200,7 @@ MyGroupSchema.statics.getInfoGroupByGroupname = async function(idapp, groupname)
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
MyGroupSchema.statics.getGroupsByUsername = async function(idapp, username) {
|
MyGroupSchema.statics.getGroupsByUsername = async function(idapp, username, req) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const {User} = require('../models/user');
|
const {User} = require('../models/user');
|
||||||
@@ -251,6 +251,7 @@ MyGroupSchema.statics.getGroupsByUsername = async function(idapp, username) {
|
|||||||
listgroups,
|
listgroups,
|
||||||
//listRequestUsersGroup,
|
//listRequestUsersGroup,
|
||||||
listSentRequestGroups,
|
listSentRequestGroups,
|
||||||
|
mygroups: req.user.profile.mygroups,
|
||||||
};
|
};
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -1275,7 +1275,7 @@ UserSchema.statics.getArrUsernameFromFieldByUsername = async function(
|
|||||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||||
}, myobj).then((ris) => ris ? ris._doc[field][subfield] : []);
|
}, myobj).then((ris) => ris ? ris._doc[field][subfield] : []);
|
||||||
|
|
||||||
if (arrrec.length > 0) {
|
if (arrrec && arrrec.length > 0) {
|
||||||
return arrrec.map(m => m.username);
|
return arrrec.map(m => m.username);
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
@@ -1902,8 +1902,12 @@ UserSchema.statics.getNameSurnameByUsername = async function(idapp, username) {
|
|||||||
return User.findOne({
|
return User.findOne({
|
||||||
idapp, username,
|
idapp, username,
|
||||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||||
}, {name: 1, surname: 1}).then((rec) => {
|
}, {username: 1, name: 1, surname: 1}).then((rec) => {
|
||||||
return (!!rec) ? `${rec.name} ${rec.surname}` : '';
|
let ris = rec.username;
|
||||||
|
if (!!rec && rec.name) {
|
||||||
|
ris = (`${rec.name} ${rec.surname}`)
|
||||||
|
}
|
||||||
|
return (!!rec) ? (`${rec.name} ${rec.surname}`) : '';
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.error('getNameSurnameByUsername', e);
|
console.error('getNameSurnameByUsername', e);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ router.post('/', async (req, res) => {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tools.blockwords(body.email) || tools.blockwords(body.name) || tools.blockwords(body.surname)) {
|
if (tools.blockwords(body.username) || tools.blockwords(body.email) || tools.blockwords(body.name) || tools.blockwords(body.surname)) {
|
||||||
// tools.writeIPToBan(iscritti.ipaddr + ': [' + iscritti.username + '] ' + iscritti.name + ' ' + iscritti.surname);
|
// tools.writeIPToBan(iscritti.ipaddr + ': [' + iscritti.username + '] ' + iscritti.name + ' ' + iscritti.surname);
|
||||||
await tools.snooze(5000);
|
await tools.snooze(5000);
|
||||||
return res.status(404).send();
|
return res.status(404).send();
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ 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) {
|
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!
|
||||||
@@ -499,7 +499,7 @@ router.post('/groups', authenticate, (req, res) => {
|
|||||||
locale = req.body.locale;
|
locale = req.body.locale;
|
||||||
|
|
||||||
|
|
||||||
return MyGroup.getGroupsByUsername(idapp, username).then((ris) => {
|
return MyGroup.getGroupsByUsername(idapp, username, req).then((ris) => {
|
||||||
res.send(ris);
|
res.send(ris);
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
tools.mylog('ERRORE IN groups: ' + e.message);
|
tools.mylog('ERRORE IN groups: ' + e.message);
|
||||||
|
|||||||
@@ -543,8 +543,8 @@ module.exports = {
|
|||||||
|
|
||||||
let out = myvar.replace('{urlunsubscribe}', urlunsibscribe);
|
let out = myvar.replace('{urlunsubscribe}', urlunsibscribe);
|
||||||
out = out.replace('{email}', mylocalsconf.emailto);
|
out = out.replace('{email}', mylocalsconf.emailto);
|
||||||
out = out.replace('{name}', mylocalsconf.name);
|
out = out.replace('{name}', mylocalsconf.name ? mylocalsconf.name : mylocalsconf.username);
|
||||||
out = out.replace('{surname}', mylocalsconf.surname);
|
out = out.replace('{surname}', mylocalsconf.surname ? mylocalsconf.surname : '');
|
||||||
|
|
||||||
return out
|
return out
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const tools = require('../tools/general');
|
|||||||
const appTelegram = [tools.FREEPLANET];
|
const appTelegram = [tools.FREEPLANET];
|
||||||
|
|
||||||
const appTelegram_TEST = [tools.FREEPLANET, tools.PDNM];
|
const appTelegram_TEST = [tools.FREEPLANET, tools.PDNM];
|
||||||
const appTelegram_DEVELOP = [tools.PDNM];
|
const appTelegram_DEVELOP = [tools.FREEPLANET];
|
||||||
|
|
||||||
const appTelegramFinti = ['2', tools.CNM];
|
const appTelegramFinti = ['2', tools.CNM];
|
||||||
const appTelegramDest = [tools.FREEPLANET, tools.FREEPLANET];
|
const appTelegramDest = [tools.FREEPLANET, tools.FREEPLANET];
|
||||||
@@ -482,10 +482,7 @@ const txt_es = {
|
|||||||
emo.EXCLAMATION_MARK +
|
emo.EXCLAMATION_MARK +
|
||||||
'\nComprueba en el sitio %s y reescribe el nuevo código de 6 dígitos.',
|
'\nComprueba en el sitio %s y reescribe el nuevo código de 6 dígitos.',
|
||||||
MSG_VERIFY_OK: emoji.get('grinning') +
|
MSG_VERIFY_OK: emoji.get('grinning') +
|
||||||
' Bienvenido %s! Ha verificado correctamente con el BOT. ' +
|
' Bienvenido %s! Ha verificado correctamente con el BOT. ' + emo.GREEN_HEART,
|
||||||
'\nSoy su asistente virtual.\nContinúa la guía paso a paso de vuelta a la página web.\n\n' +
|
|
||||||
'Este chat le ayudará a ver rápidamente su pizarra y recibir alertas importantes sobre cómo proceder.\n\nUtilice el menú de abajo para comprobar su situación.' +
|
|
||||||
emo.GREEN_HEART,
|
|
||||||
MSG_ERR_UNKNOWN_VERIFY_CODE: 'Error al guardar en el servidor. Inténtalo de nuevo más tarde.',
|
MSG_ERR_UNKNOWN_VERIFY_CODE: 'Error al guardar en el servidor. Inténtalo de nuevo más tarde.',
|
||||||
MSG_EXIT_TELEGRAM: 'La cuenta ha sido desconectada de Telegram BOT.',
|
MSG_EXIT_TELEGRAM: 'La cuenta ha sido desconectada de Telegram BOT.',
|
||||||
MSG_APORTADOR_USER_REGISTERED: emo.FIRE +
|
MSG_APORTADOR_USER_REGISTERED: emo.FIRE +
|
||||||
@@ -653,6 +650,9 @@ module.exports = {
|
|||||||
let userdest = mylocalsconf.user.aportador_solidario;
|
let userdest = mylocalsconf.user.aportador_solidario;
|
||||||
let langdest = mylocalsconf.user.lang;
|
let langdest = mylocalsconf.user.lang;
|
||||||
let NameFrom = `${mylocalsconf.user.name} ${mylocalsconf.user.surname}`;
|
let NameFrom = `${mylocalsconf.user.name} ${mylocalsconf.user.surname}`;
|
||||||
|
if (!mylocalsconf.user.name) {
|
||||||
|
NameFrom = `${mylocalsconf.user.username}`;
|
||||||
|
}
|
||||||
const index = mylocalsconf.user.index;
|
const index = mylocalsconf.user.index;
|
||||||
|
|
||||||
let aportador = '';
|
let aportador = '';
|
||||||
@@ -670,8 +670,8 @@ module.exports = {
|
|||||||
userdest) + aportador;
|
userdest) + aportador;
|
||||||
aportador = NameFrom;
|
aportador = NameFrom;
|
||||||
}
|
}
|
||||||
text = printf(getstr(langdest, 'MSG_APORTADOR_USER_REGISTERED'),
|
let nome = tools.getNomeCognomeEUserNameByUser(mylocalsconf.user);
|
||||||
`${mylocalsconf.user.name} ${mylocalsconf.user.surname} (${mylocalsconf.user.username})`);
|
text = printf(getstr(langdest, 'MSG_APORTADOR_USER_REGISTERED'), nome);
|
||||||
}
|
}
|
||||||
|
|
||||||
let addtext = '';
|
let addtext = '';
|
||||||
@@ -801,8 +801,8 @@ module.exports = {
|
|||||||
|
|
||||||
if (!!user) {
|
if (!!user) {
|
||||||
msg = msg.replace('{username}', user.username);
|
msg = msg.replace('{username}', user.username);
|
||||||
msg = msg.replace('{name}', user.name);
|
msg = msg.replace('{name}', user.name ? user.name : user.username);
|
||||||
msg = msg.replace('{surname}', user.surname);
|
msg = msg.replace('{surname}', user.surname ? user.surname : '');
|
||||||
if (!!user.profile.link_payment)
|
if (!!user.profile.link_payment)
|
||||||
msg = msg.replace('{link_paypalme}', user.profile.link_payment);
|
msg = msg.replace('{link_paypalme}', user.profile.link_payment);
|
||||||
if (!!user.profile.revolut)
|
if (!!user.profile.revolut)
|
||||||
@@ -3390,17 +3390,15 @@ if (true) {
|
|||||||
await local_sendMsgTelegram(user.idapp, data.username, msgOrig);
|
await local_sendMsgTelegram(user.idapp, data.username, msgOrig);
|
||||||
await local_sendMsgTelegram(user.idapp, data.userDest, msgDest);
|
await local_sendMsgTelegram(user.idapp, data.userDest, msgDest);
|
||||||
|
|
||||||
} else if (data.action === InlineConferma.RISPOSTA_NO +
|
} else if (data.action === InlineConferma.RISPOSTA_NO + shared_consts.CallFunz.REGISTRATION) {
|
||||||
shared_consts.CallFunz.REGISTRATION) {
|
|
||||||
await myclTelegram.setCmdToUsername(rec, data.username,
|
await myclTelegram.setCmdToUsername(rec, data.username,
|
||||||
Cmd.VALIDATE_REGISTRATION, false);
|
Cmd.VALIDATE_REGISTRATION, false);
|
||||||
|
|
||||||
const msgOrig = printf(
|
const nomeDest = tools.getNomeCognomeEUserNameByUser(userDest);
|
||||||
getstr(userDest.lang, 'MSG_APORTADOR_DEST_NOT_CONFIRMED'),
|
const nomestr = tools.getNomeCognomeEUserNameByUser(user);
|
||||||
`${userDest.name + ' ' + userDest.surname}`);
|
|
||||||
const msgDest = printf(
|
const msgOrig = printf(getstr(userDest.lang, 'MSG_APORTADOR_DEST_NOT_CONFIRMED', nomeDest));
|
||||||
getstr(user.lang, 'MSG_APORTADOR_NOT_CONFIRMED'),
|
const msgDest = printf(getstr(user.lang, 'MSG_APORTADOR_NOT_CONFIRMED'),nomestr);
|
||||||
`${user.name + ' ' + user.surname}`);
|
|
||||||
|
|
||||||
await local_sendMsgTelegram(user.idapp, data.username, msgOrig);
|
await local_sendMsgTelegram(user.idapp, data.username, msgOrig);
|
||||||
await local_sendMsgTelegram(user.idapp, data.userDest, msgDest);
|
await local_sendMsgTelegram(user.idapp, data.userDest, msgDest);
|
||||||
|
|||||||
@@ -820,14 +820,15 @@ 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), username);
|
||||||
openUrl = '/my/' + username;
|
openUrl = '/my/' + username;
|
||||||
tag = 'reqfriends';
|
tag = 'reqfriends';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userId) {
|
if (userId) {
|
||||||
this.sendNotificationToUser(userId, title, descr, openUrl, '', tag, actions);
|
this.sendNotificationToUser(userId, title, descr, openUrl, '', tag,
|
||||||
|
actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (telegram) {
|
if (telegram) {
|
||||||
@@ -845,7 +846,8 @@ module.exports = {
|
|||||||
var {User} = require('../models/user');
|
var {User} = require('../models/user');
|
||||||
var {MyGroup} = require('../models/mygroup');
|
var {MyGroup} = require('../models/mygroup');
|
||||||
|
|
||||||
const group = await MyGroup.findOne({idapp, groupname}, {_id: 1, admins: 1});
|
const group = await MyGroup.findOne({idapp, groupname},
|
||||||
|
{_id: 1, admins: 1});
|
||||||
if (!group)
|
if (!group)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -891,13 +893,15 @@ module.exports = {
|
|||||||
if (telegram) {
|
if (telegram) {
|
||||||
const telegrambot = require('../telegram/telegrambot');
|
const telegrambot = require('../telegram/telegrambot');
|
||||||
|
|
||||||
const idtelegram = await User.TelegIdByUsername(idapp, arradmins.username);
|
const idtelegram = await User.TelegIdByUsername(idapp,
|
||||||
|
arradmins.username);
|
||||||
|
|
||||||
await telegrambot.sendMsgTelegramByIdTelegram(idapp, idtelegram, descr);
|
await telegrambot.sendMsgTelegramByIdTelegram(idapp, idtelegram,
|
||||||
|
descr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (e){
|
} catch (e) {
|
||||||
console.error('sendNotificationByGroupname', e);
|
console.error('sendNotificationByGroupname', e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1360,7 +1364,11 @@ module.exports = {
|
|||||||
if (myfilter['userId']) {
|
if (myfilter['userId']) {
|
||||||
myfilter['userId'] = ObjectID(myfilter['userId']);
|
myfilter['userId'] = ObjectID(myfilter['userId']);
|
||||||
}
|
}
|
||||||
filtriadded.push(myfilter);
|
if (myfilter['_idOBJ']) {
|
||||||
|
filtriadded.push({_id: ObjectID(myfilter['_idOBJ'])});
|
||||||
|
} else {
|
||||||
|
filtriadded.push(myfilter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1399,13 +1407,81 @@ module.exports = {
|
|||||||
if (numrowend < 0)
|
if (numrowend < 0)
|
||||||
numrowend = 1;
|
numrowend = 1;
|
||||||
|
|
||||||
|
if (params.querytype === shared_consts.QUERYTYPE_MYGROUP) {
|
||||||
|
// query.push({'$addFields': {'myid': {'$toObjectId': params.myid}}});
|
||||||
|
/*query.push({
|
||||||
|
$match: {
|
||||||
|
$and: [
|
||||||
|
{idapp},
|
||||||
|
{'_id': '$myid'},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
*/
|
||||||
|
query.push({
|
||||||
|
$match: {
|
||||||
|
$expr: {
|
||||||
|
$eq: [
|
||||||
|
'$_id',
|
||||||
|
{
|
||||||
|
'$toObjectId': params.myid,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
query.push({$project: {req_users: 1}});
|
||||||
|
const qa1 = this.getLookup(
|
||||||
|
{
|
||||||
|
lk_tab: 'users',
|
||||||
|
lk_LF: 'req_users.username',
|
||||||
|
lk_FF: 'username',
|
||||||
|
lk_as: 'user',
|
||||||
|
}, 0, {
|
||||||
|
'user.idapp': 1,
|
||||||
|
'user.username': 1,
|
||||||
|
'user.profile.img': 1,
|
||||||
|
'user.profile.qualifica': 1,
|
||||||
|
});
|
||||||
|
if (qa1) query = [...query, ...qa1];
|
||||||
|
query.push({$unwind: '$user'});
|
||||||
|
query.push({
|
||||||
|
$match: {
|
||||||
|
$and: [
|
||||||
|
{'user.idapp': idapp},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
query.push({
|
||||||
|
$replaceRoot: {
|
||||||
|
newRoot: '$user',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (newvers) {
|
if (newvers) {
|
||||||
// NUOVA VERSIONE
|
// NUOVA VERSIONE
|
||||||
let proj = params.lookup2 ? params.lookup2.lk_proj : null;
|
let proj = params.lookup2 ? params.lookup2.lk_proj : null;
|
||||||
|
|
||||||
|
if (params.proj0) {
|
||||||
|
query.push({$project: params.proj0});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.unwind0) {
|
||||||
|
query.push({$unwind: params.unwind0});
|
||||||
|
}
|
||||||
|
|
||||||
const q1 = this.getLookup(params.lookup1, 1, proj);
|
const q1 = this.getLookup(params.lookup1, 1, proj);
|
||||||
if (q1) query = [...query, ...q1];
|
if (q1) query = [...query, ...q1];
|
||||||
|
|
||||||
|
if (params.unwind1) {
|
||||||
|
query.push({$unwind: params.unwind1});
|
||||||
|
}
|
||||||
|
|
||||||
const q2 = this.getLookup(params.lookup2, 2, proj);
|
const q2 = this.getLookup(params.lookup2, 2, proj);
|
||||||
if (q2) query = [...query, ...q2];
|
if (q2) query = [...query, ...q2];
|
||||||
|
|
||||||
@@ -2116,7 +2192,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
isFileExists(filename) {
|
isFileExists(filename) {
|
||||||
return fs.existsSync(filename)
|
return fs.existsSync(filename);
|
||||||
},
|
},
|
||||||
|
|
||||||
getiPAddressUser(req) {
|
getiPAddressUser(req) {
|
||||||
@@ -2243,7 +2319,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
blockwords(mystr) {
|
blockwords(mystr) {
|
||||||
const arrwords = ['http', 'Http', 'Asasfasfas', '://', 'mrbit'];
|
const arrwords = ['http', 'Http', 'Asasfasfas', '://', 'mrbit', 'admin', 'info', 'superuser'];
|
||||||
for (const myword of arrwords) {
|
for (const myword of arrwords) {
|
||||||
if (mystr.includes(myword)) {
|
if (mystr.includes(myword)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -2360,4 +2436,13 @@ module.exports = {
|
|||||||
return count;
|
return count;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getNomeCognomeEUserNameByUser(user) {
|
||||||
|
let nome = `${user.name} ${user.surname} (${user.username})`
|
||||||
|
if (!user.name) {
|
||||||
|
nome = user.username;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nome;
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ module.exports = {
|
|||||||
CHECK_SEE_VIDEO_PRINCIPI: 2,
|
CHECK_SEE_VIDEO_PRINCIPI: 2,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
QUERYTYPE_MYGROUP: 1,
|
||||||
|
|
||||||
ALL_SAW_AND_ACCEPTED: 3,
|
ALL_SAW_AND_ACCEPTED: 3,
|
||||||
// ---------------------
|
// ---------------------
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user