Nella pagina profilo, i "Gruppi" personali non si vedevano !
Cancellazione di un Gruppo corretto filtro di visiblità dei Gruppi
This commit is contained in:
@@ -124,8 +124,10 @@ const textlang = {
|
||||
'ZOOM_CONFERMATO': 'Sei stato confermato ad aver visto la Video Conferenza di Benvenuto!',
|
||||
'RICHIESTA_AMICIZIA': '🌈 Richiesta d\'Amicizia da parte di %s',
|
||||
'ACCETTATO_SUL_GRUPPO': '✅ Sei stato accettato da %s a far parte del Gruppo %s',
|
||||
'CREATO_NUOVO_GRUPPO': '✅ Hai appena creato un nuovo Gruppo chiamato %s',
|
||||
'ACCETTATO_NOTIFICA_ADMINS': '✅ l\'utente %s è stato accettato a far parte del Gruppo %s (da parte di %s)',
|
||||
'RICHIESTA_GRUPPO': 'Richiesta di entrare nel Gruppo %s da parte di %s',
|
||||
'GRUPPO_ELIMINATO': 'Il gruppo %s è stato eliminato da parte di %s',
|
||||
'RICHIESTA_BLOCCO_GRUPPO': 'Richiesta di bloccare il Gruppo %s da parte di %s',
|
||||
},
|
||||
si: {},
|
||||
@@ -925,9 +927,15 @@ module.exports = {
|
||||
actions: [],
|
||||
};
|
||||
|
||||
let creazionegruppo = false;
|
||||
|
||||
for (const singleadmin of arrusernameAdmins) {
|
||||
try {
|
||||
if (singleadmin.username) {
|
||||
|
||||
creazionegruppo = arrusernameAdmins.length === 1 && usernameOrig === singleadmin.username && cmd ===
|
||||
shared_consts.GROUPSCMD.SETGROUP;
|
||||
|
||||
const user = await User.findOne({idapp, username: singleadmin.username},
|
||||
{_id: 1, lang: 1});
|
||||
if (user) {
|
||||
@@ -939,7 +947,11 @@ module.exports = {
|
||||
|
||||
if (cmd) {
|
||||
if (cmd === shared_consts.GROUPSCMD.SETGROUP) {
|
||||
objmsg.descr = printf(this.get__('ACCETTATO_NOTIFICA_ADMINS', lang), usernameOrig, groupname, username_action);
|
||||
if (creazionegruppo) {
|
||||
objmsg.descr = printf(this.get__('CREATO_NUOVO_GRUPPO', lang), groupname);
|
||||
} else {
|
||||
objmsg.descr = printf(this.get__('ACCETTATO_NOTIFICA_ADMINS', lang), usernameOrig, groupname, username_action);
|
||||
}
|
||||
objmsg.openUrl = '/grp/' + groupname;
|
||||
objmsg.tag = 'addgroups';
|
||||
|
||||
@@ -958,11 +970,15 @@ module.exports = {
|
||||
groupname, singleadmin.username);
|
||||
objmsg.openUrl = '/grp/' + groupname;
|
||||
objmsg.tag = 'blockgroups';
|
||||
} else if (cmd === shared_consts.GROUPSCMD.DELETE_GROUP) {
|
||||
objmsg.descr = printf(this.get__('GRUPPO_ELIMINATO', lang), groupname, username_action);
|
||||
objmsg.openUrl = '/grp/' + groupname;
|
||||
objmsg.tag = 'deletegroup';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (sendnotif && objmsg.descr) {
|
||||
if (sendnotif && objmsg.descr && !creazionegruppo) {
|
||||
await this.sendNotifAndMsgTelegram(idapp, userId, objmsg, telegram, struserinfomsg);
|
||||
}
|
||||
|
||||
@@ -975,10 +991,13 @@ module.exports = {
|
||||
|
||||
if (cmd === shared_consts.GROUPSCMD.SETGROUP) {
|
||||
const reclang = await User.getRecLangAndIdByUsername(idapp, usernameOrig);
|
||||
objmsg.descr = printf(this.get__('ACCETTATO_SUL_GRUPPO', reclang.lang), username_action, groupname);
|
||||
objmsg.openUrl = '/grp/' + groupname;
|
||||
objmsg.tag = 'addgroups';
|
||||
|
||||
if (creazionegruppo) {
|
||||
objmsg.descr = printf(this.get__('CREATO_NUOVO_GRUPPO', reclang.lang), groupname);
|
||||
} else {
|
||||
objmsg.descr = printf(this.get__('ACCETTATO_SUL_GRUPPO', reclang.lang), username_action, groupname);
|
||||
}
|
||||
// Send to User:
|
||||
await this.sendNotifAndMsgTelegram(idapp, reclang._id, objmsg, telegram);
|
||||
}
|
||||
@@ -1701,12 +1720,46 @@ module.exports = {
|
||||
};
|
||||
|
||||
query.push({$match: {$and: [condition]}});
|
||||
} else if (shared_consts.TABLES_ENABLE_GETREC_BYID.includes(params.table)) {
|
||||
// Rimuovi dalla query quelli non visibili
|
||||
|
||||
let arraygroups = [];
|
||||
|
||||
if (user && user.profile.mygroups) {
|
||||
arraygroups = user.profile.mygroups.map(rec => rec.groupname);
|
||||
}
|
||||
// prendere i gruppi dell'utente
|
||||
|
||||
// Cerca tra i gruppi di ogni record, se combaciano almeno 1
|
||||
condition = {
|
||||
'profile.mygroups':
|
||||
{
|
||||
$elemMatch: {
|
||||
groupname: {$in: arraygroups},
|
||||
},
|
||||
|
||||
},
|
||||
};
|
||||
|
||||
query.push(
|
||||
{
|
||||
$match:
|
||||
{
|
||||
$or: [
|
||||
{
|
||||
$and: [condition, {pub_to_share: 1}],
|
||||
},
|
||||
{$or: [{pub_to_share: {$exists: false}}, {pub_to_share: {$exists: true, $eq: shared_consts.PUBTOSHARE.ALL}}]},
|
||||
],
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (params.filtersearch3or) {
|
||||
if (params.filtersearch3or.length > 0) {
|
||||
query.push({$match: {$or: params.filtersearch3or}});
|
||||
|
||||
Reference in New Issue
Block a user