Conto Comunitario...

This commit is contained in:
Surya Paolo
2023-01-12 01:03:10 +01:00
parent e13fe84709
commit f7d05eb856
6 changed files with 100 additions and 87 deletions

View File

@@ -380,7 +380,7 @@ AccountSchema.statics.getGroupAccounts = async function (idapp, groupname) {
{ $eq: ['$typedir', '$$typedir'] },
{ $eq: ['$typeid', '$$typeid'] },
{ $eq: ['$status', 0] },
{ $eq: ['$sender', '$$username'] },
{ $eq: ['$sendergroup', '$$groupname'] },
{ $eq: ['$idapp', '$$idapp'] },
{ $eq: ['$extrarec.circuitname', '$$circuitname'] },
],

View File

@@ -227,7 +227,7 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif) {
newdescr = i18n.__('ACCETTATO_NOTIFICA_ADMINS', userorig, recnotif.paramsObj.groupnameDest, recnotif.paramsObj.username_action);
recnotif.openUrl = '/my/' + userorig;
} else {
newdescr = i18n.__('GROUPS_ACCEPTED', userorig, recnotif.paramsObj.groupnameDest, recnotif.paramsObj.username_action);
newdescr = i18n.__('GROUPS_ACCEPTED', recnotif.paramsObj.groupnameDest, recnotif.paramsObj.username_action);
}
tag = 'addgroup';
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_GROUP_REMOVED) {

View File

@@ -1656,9 +1656,11 @@ UserSchema.statics.getUserProfileByUsername = async function (
'useraport.profile.img': 1,
};
}
let regexpusername = new RegExp(`^${username}$`, 'i');
const myfind = {
idapp, username,
idapp, username: { $regex: regexpusername },
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
};
@@ -4536,6 +4538,12 @@ UserSchema.statics.addExtraInfo = async function (idapp, recUser, recUserSave) {
const circuitobj = await Circuit.getCircuitsByUsername(idapp, recUser.username, recUser);
const useraccounts = await Account.getUserAccounts(idapp, recUser.username);
for (const group of listManageGroups) {
const myaccounts = await Account.getGroupAccounts(idapp, group.groupname);
if (myaccounts && myaccounts.length > 0)
group.account = myaccounts[0]
}
recUser.profile = { ...recUser.profile, ...circuitobj, useraccounts };