Modifiche prima di Luglio...

This commit is contained in:
Surya Paolo
2023-08-27 23:55:31 +02:00
parent ba81a33c88
commit ad6b4c2bfa
21 changed files with 1747 additions and 2251 deletions

View File

@@ -98,6 +98,9 @@ const sendNotifSchema = new Schema({
},
textaddTelegram: {
type: String,
},
linkaddTelegram: {
type: String,
}
});
@@ -197,7 +200,7 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TABLES_MYHOSPS, true) + myidrec;
tag = 'newhosp';
}
recnotif.textaddTelegram = 'Vedi annuncio';
recnotif.linkaddTelegram = 'Vedi annuncio';
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_EVENTS) {
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TABLES_MYBACHECAS, true) + myidrec;
tag = 'newevent';
@@ -217,7 +220,7 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
tag = 'attend';
recnotif.openUrl = shared_consts.getDirectoryByTable(recnotif.paramsObj.recObjCreator.table, true) + recnotif.paramsObj.recObjCreator.id;
recnotif.textaddTelegram = 'Vedi post';
recnotif.linkaddTelegram = 'Vedi post';
}
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_FRIENDS) {
@@ -332,6 +335,7 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
let username_action = '';
let username_mittente = '';
let circuitname = '';
let numuserincircuit = 0;
try {
username_action = recnotif.paramsObj.username_action
username_mittente = recnotif.paramsObj.sender ? recnotif.paramsObj.sender : username_action
@@ -341,9 +345,13 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
qty = recnotif.paramsObj.extrarec && recnotif.paramsObj.extrarec.qty ? recnotif.paramsObj.extrarec.qty.toString() : '';
symbol = recnotif.paramsObj.extrarec ? recnotif.paramsObj.extrarec.symbol : '';
circuitname = recnotif.paramsObj.circuitnameDest;
numuserincircuit = await User.countUsersInCircuit(recnotif.idapp, circuitname);
} catch (e) {
}
recnotif.textaddTelegram = '';
if (groupOComdest) {
destinatario += ' (' + username_mittente + ')'
}
@@ -408,18 +416,19 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
tag = 'refcircuit';
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_REQUEST_TO_ENTER) {
aportador_solidario = await User.getAportadorSolidarioByUsername(idapp, sender);
aportador_solidario = await User.getAportadorSolidarioByUsername(recnotif.idapp, sender);
if (recnotif.extrarec.groupname) {
newdescr = i18n.__('CIRCUIT_REQUEST_TO_ENTER_WITH_GROUP', recnotif.extrarec.groupname, recnotif.paramsObj.circuitnameDest,
recnotif.paramsObj.singleadmin_username);
numuserincircuit, recnotif.paramsObj.singleadmin_username);
} else {
newdescr = i18n.__('CIRCUIT_REQUEST_TO_ENTER', sender, '<strong>' + recnotif.paramsObj.circuitnameDest + '</strong>', aportador_solidario);
newdescr = i18n.__('CIRCUIT_REQUEST_TO_ENTER', sender, '<strong>' + recnotif.paramsObj.circuitnameDest + '</strong>', numuserincircuit, aportador_solidario);
const myadmins = await Circuit.getListAdmins(recnotif.idapp, recnotif.paramsObj.circuitnameDest);
newdescr += '\n' + i18n.__('CIRCUIT_ADMINS', myadmins.num, myadmins.str);
newdescr += '\n' + i18n.__('CIRCUIT_WHERE_IS_PRESENT', await Circuit.getListCircuitsByUsername(recnotif.idapp, sender, recnotif.extrarec.groupname));
}
const myadmins = await Circuit.getListAdmins(recnotif.idapp, recnotif.paramsObj.circuitnameDest);
recnotif.textaddTelegram += '\n' + i18n.__('CIRCUIT_ADMINS', myadmins.num, myadmins.str);
recnotif.textaddTelegram += '\n' + i18n.__('CIRCUIT_WHERE_IS_PRESENT', await Circuit.getListCircuitsByUsername(recnotif.idapp, sender, recnotif.extrarec.groupname));
tag = 'reqcircuits';
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_DELETE_USER) {
@@ -530,7 +539,7 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
tag = 'favorite';
recnotif.openUrl = shared_consts.getDirectoryByTable(recnotif.paramsObj.recObjCreator.table, true) + recnotif.paramsObj.recObjCreator.id;
recnotif.textaddTelegram = 'Vedi post';
recnotif.linkaddTelegram = 'Vedi post';
}
recnotif.tag = recnotif.tag ? recnotif.tag : tag;