- Gruppi (3) - lista degli utenti del gruppo

This commit is contained in:
paoloar77
2022-02-05 23:28:15 +01:00
parent daf872fe55
commit 16664f7be7
12 changed files with 387 additions and 107 deletions

View File

@@ -120,6 +120,8 @@ const textlang = {
'MSG_SEND_FROM': 'Msg Inviato da',
'ZOOM_CONFERMATO': 'Sei stato confermato ad aver visto la Video Conferenza di Benvenuto!',
'RICHIESTA_AMICIZIA': 'Richiesta d\'Amicizia da parte di %s',
'RICHIESTA_GRUPPO': 'Richiesta di entrare nel Gruppo %s da parte di %s',
'RICHIESTA_BLOCCO_GRUPPO': 'Richiesta di bloccare il Gruppo %s da parte di %s',
},
si: {},
es: {
@@ -851,35 +853,52 @@ module.exports = {
const arrusernameAdmins = group.admins;
for (const username of arrusernameAdmins) {
const user = await User.get
let userId = user._id;
let lang = user.lang;
for (const arradmins of arrusernameAdmins) {
try {
if (arradmins.username) {
const user = await User.findOne({idapp, username: arradmins.username},
{_id: 1, lang: 1});
if (user) {
let title = this.getNomeAppByIdApp(idapp);
let descr = '';
let openUrl = '/';
let tag = '';
let actions = [];
if (cmd) {
if (cmd === shared_consts.FRIENDSCMD.REQFRIEND) {
descr = printf(this.get__('RICHIESTA_AMICIZIA', lang), username);
openUrl = '/my/' + username;
tag = 'reqfriends';
let userId = user._id;
let lang = user.lang;
let title = this.getNomeAppByIdApp(idapp);
let descr = '';
let openUrl = '/';
let tag = '';
let actions = [];
if (cmd) {
if (cmd === shared_consts.GROUPSCMD.REQGROUP) {
descr = printf(this.get__('RICHIESTA_GRUPPO', lang), groupname,
arradmins.username);
openUrl = '/grp/' + groupname;
tag = 'reqgroups';
} else if (cmd === shared_consts.GROUPSCMD.BLOCK_USER) {
descr = printf(this.get__('RICHIESTA_BLOCCO_GRUPPO', lang),
groupname, arradmins.username);
openUrl = '/grp/' + groupname;
tag = 'blockgroups';
}
}
if (userId) {
this.sendNotificationToUser(userId, title, descr, openUrl, '',
tag,
actions);
}
if (telegram) {
const telegrambot = require('../telegram/telegrambot');
const idtelegram = await User.TelegIdByUsername(idapp, arradmins.username);
await telegrambot.sendMsgTelegramByIdTelegram(idapp, idtelegram, descr);
}
}
}
}
if (userId) {
this.sendNotificationToUser(userId, title, descr, openUrl, '', tag,
actions);
}
if (telegram) {
const telegrambot = require('../telegram/telegrambot');
const idtelegram = await User.TelegIdByUsername(idapp, username);
await telegrambot.sendMsgTelegramByIdTelegram(idapp, idtelegram, descr);
}catch (e){
console.error('sendNotificationByGroupname', e);
}
}