set notif if service your province

This commit is contained in:
Surya Paolo
2023-04-13 13:46:48 +02:00
parent cada7aa0b6
commit cda0bff21f
7 changed files with 136 additions and 35 deletions

View File

@@ -182,14 +182,19 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_BACHECA) {
if (recnotif.typeid === shared_consts.TypeNotifs.ID_BACHECA_NEW_GOOD) {
newdescr = i18n.__('<strong>%s</strong> new Good: %s', userorig, mydescr);
newdescr = i18n.__('NEW_GOOD', userorig, mydescr);
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TABLES_MYGOODS, true) + myidrec;
tag = 'newgood';
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_BACHECA_NEW_SERVICE) {
newdescr = i18n.__('<strong>%s</strong> new Service: %s', userorig, mydescr);
newdescr = i18n.__('NEW_SERVICE', userorig, mydescr);
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TABLES_MYSKILLS, true) + myidrec;
tag = 'newservice';
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_BACHECA_NEW_HOSP) {
newdescr = i18n.__('NEW_HOSP', userorig, mydescr);
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TABLES_MYHOSPS, true) + myidrec;
tag = 'newhosp';
}
recnotif.textaddTelegram = 'Vedi post';
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_FRIENDS) {
recnotif.openUrl = '/my/' + sender;
if (recnotif.typeid === shared_consts.TypeNotifs.ID_FRIENDS_NEW_REC) {
@@ -882,6 +887,7 @@ sendNotifSchema.statics.sendToTheDestinations = async function (myrecnotifpass,
lang: 1,
username: 1,
'profile.notifs': 1,
'profile.resid_province': 1,
'profile.notif_idCities': 1,
'profile.notif_provinces': 1,
'profile.notif_regions': 1,
@@ -939,6 +945,10 @@ sendNotifSchema.statics.sendToTheDestinations = async function (myrecnotifpass,
shared_consts.TABLES_EVENTS_NOTIFICATION.includes(myrecnotifpass.tablerec)) {
// Estrai la Città, la Provincia e la regione.
if (usernotifprofile && tools.isBitActive(usernotifprofile.value, shared_consts.UsersNotif.NEW_ADV_YOUR_PROVINCE) &&
user.profile.resid_province && arrprovinces.indexOf(user.profile.resid_province) >= 0) {
send = true;
}
if (usernotifprofile && tools.isBitActive(usernotifprofile.value, shared_consts.UsersNotif.NEW_ADV_PROVINCE) &&
user.profile.notif_provinces && user.profile.notif_provinces.some(r => arrprovinces.indexOf(r) >= 0)) {
send = true;