-Poter entrare nel login anche con l'username Telegram !
- Se clicchi sulla foto, mi apre il profilo anzichè l'invio dei RIS - ++ Filtro sulle ricerche: Scegliere un Circuito specifico. - Nella lista iscritti compaiono anche i cancellati... - n "Attività" si vede tutto allargato, non sta nella dimensione della pagina. - Nelle notifiche della campanellina non si vede più il titolo... (è vuoto). - Non funziona il Filtro per Settore (nella Home sugli Eventi) - Filtri avanzati da mostrare solo se clicco sul bottone. - I menu in basso non funzionano ! - Nel menu "Iscritti" del circuito, non compare più la ricerca ! Riattivarla - Opzione di mandare una email quando uno si registra al Circuito - ++ Opzione per il Circuito: Chiedi di entrare agli admin (e non in automatico).
This commit is contained in:
@@ -4,11 +4,13 @@
|
||||
"Good": "Bene",
|
||||
"Service": "Servizio",
|
||||
"Hosp": "Ospitalità",
|
||||
"Hosp %s": "Ospitalità: %s",
|
||||
"Event": "Evento",
|
||||
"Good: %s": "Bene: %s",
|
||||
"Service: %s": "Servizio: %s",
|
||||
"NEW_GOOD": "❇️ <strong>%s</strong> ha aggiunto un nuovo Bene: \n<strong>%s</strong>",
|
||||
"NEW_SERVICE": "❇️ <strong>%s</strong> ha aggiunto un nuovo Servizio: \n<strong>%s</strong>",
|
||||
"NEW_HOSP": "❇️ <strong>%s</strong> ha aggiunto una nuova Ospitalità: \n<strong>%s</strong>",
|
||||
"NEW_GOOD": "❇️ <strong>%s</strong> ha aggiunto un nuovo Bene: \n<strong>%s</strong> a %s",
|
||||
"NEW_SERVICE": "❇️ <strong>%s</strong> ha aggiunto un nuovo Servizio: \n<strong>%s</strong> a %s",
|
||||
"NEW_HOSP": "❇️ <strong>%s</strong> ha aggiunto una nuova Ospitalità: \n<strong>%s</strong> a %s",
|
||||
"NEW_EVENT": "❇️ <strong>%s</strong> ha aggiunto un nuovo Evento: \n%s\n<strong>%s</strong>\n%s",
|
||||
"NEW_EVENT_TELEGRAM": "%s\n\n❇️ <strong>%s</strong>\n\n%s\n\n%s",
|
||||
"NEW_ANNUNCIO_TELEGRAM": "❇️ <strong>%s</strong>\n\n%s\n\n%s",
|
||||
@@ -56,6 +58,8 @@
|
||||
"CIRCUIT_OPEN_RISITALIA": "Apri il Circuito RIS Italia e chiedi di entrare",
|
||||
"CIRCUIT_REQUEST_TO_ENTER": "%s è entrato nel %s (con %s iscritti) ed è in attesa di essere abilitato alla Fiducia\n🙎🏻♂️ Invitato da %s",
|
||||
"CIRCUIT_REQUEST_TO_ENTER_ASKMANAGER": "%s ha fatto richiesta di entrare nel %s (con %s iscritti)\n🙎🏻♂️ Invitato da %s",
|
||||
"CIRCUIT_REQUEST_TO_ENTER_ASKMANAGER_SHORT": "%s ha fatto richiesta di entrare nel %s (con %s iscritti)\n🙎🏻♂️ Invitato da %s",
|
||||
"CIRCUIT_REQUEST_TO_ENTER_ASKMANAGER_TITLE": "++ Nuova Richiesta di %s",
|
||||
"CIRCUIT_ADMINS": "Gli amministratori del circuito sono %s:\n%s",
|
||||
"CIRCUIT_WHERE_IS_PRESENT": "\nAttualmente è presente in: %s",
|
||||
"CIRCUIT_REQUEST_TO_ENTER_WITH_GROUP": "il gruppo %s ha chiesto di entrare nel %s (con %s iscritti)",
|
||||
|
||||
@@ -264,7 +264,7 @@ CircuitSchema.statics.findAllIdApp = async function (idapp) {
|
||||
|
||||
const whatToShow = this.getWhatToShow(idapp, '');
|
||||
|
||||
return await Circuit.find(myfind, whatToShow).sort({ status: -1, numMembers: -1, name: 1 });
|
||||
return await Circuit.find(myfind, whatToShow).lean().sort({ name: 1 });
|
||||
};
|
||||
|
||||
CircuitSchema.statics.isCircuitAdmin = async function (idrec, username) {
|
||||
@@ -450,7 +450,7 @@ CircuitSchema.statics.getCircuitsByUsername = async function (idapp, username, u
|
||||
$or: [
|
||||
{ deleted: { $exists: false } },
|
||||
{ deleted: { $exists: true, $eq: false } }],
|
||||
}, whatToShow_Unknown).sort({ status: -1, numMembers: -1, name: 1 }).lean();
|
||||
}, whatToShow_Unknown).sort({ name: 1 }).lean();
|
||||
|
||||
let asked_circuits = await Circuit.find({
|
||||
idapp,
|
||||
@@ -970,6 +970,15 @@ CircuitSchema.statics.getNameByCircuitId = async function (circuitId) {
|
||||
|
||||
return '';
|
||||
|
||||
};
|
||||
CircuitSchema.statics.getPathByCircuitName = async function (idapp, circuitName) {
|
||||
|
||||
let circuit = await Circuit.findOne({ idapp, name: circuitName }).lean();
|
||||
if (circuit)
|
||||
return '/' + shared_consts.getDirectoryByTable('circuits') + '/' + circuit.path;
|
||||
|
||||
return '';
|
||||
|
||||
};
|
||||
|
||||
CircuitSchema.statics.getCircuitByCircuitId = async function (circuitId) {
|
||||
|
||||
@@ -174,7 +174,7 @@ MyGroupSchema.statics.findAllGroups = async function (idapp) {
|
||||
$or: [
|
||||
{ deleted: { $exists: false } },
|
||||
{ deleted: { $exists: true, $eq: false } }],
|
||||
}, whatToShow);
|
||||
}, whatToShow).lean();
|
||||
};
|
||||
|
||||
// Rimuovo la Richiesta del Gruppo
|
||||
|
||||
@@ -216,31 +216,33 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
|
||||
const { User } = require('../models/user');
|
||||
|
||||
try {
|
||||
let dovestr = '';
|
||||
if (recnotif.myrectableorig) {
|
||||
myidrec = recnotif.myrectableorig._id;
|
||||
mydescr = recnotif.myrectableorig.descr ? tools.firstchars(recnotif.myrectableorig.descr, numchars) : '';
|
||||
dovestr = tools.getDoveStrByAnnuncio(recnotif.myrectableorig);
|
||||
}
|
||||
|
||||
if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_BACHECA) {
|
||||
let tablerec = '';
|
||||
if (recnotif.typeid === shared_consts.TypeNotifs.ID_BACHECA_NEW_GOOD) {
|
||||
newdescr = i18n.__('NEW_GOOD', userorig, mydescr);
|
||||
newdescr = i18n.__('NEW_GOOD', userorig, mydescr, dovestr);
|
||||
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TABLES_MYGOODS, true) + myidrec;
|
||||
tag = 'newgood';
|
||||
tablerec = 'mygoods';
|
||||
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_BACHECA_NEW_SERVICE) {
|
||||
newdescr = i18n.__('NEW_SERVICE', userorig, mydescr);
|
||||
newdescr = i18n.__('NEW_SERVICE', userorig, mydescr, dovestr);
|
||||
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TABLES_MYSKILLS, true) + myidrec;
|
||||
tag = 'newservice';
|
||||
tablerec = 'myskills';
|
||||
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_BACHECA_NEW_HOSP) {
|
||||
newdescr = i18n.__('NEW_HOSP', userorig, mydescr);
|
||||
newdescr = i18n.__('NEW_HOSP', userorig, mydescr, dovestr);
|
||||
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TABLES_MYHOSPS, true) + myidrec;
|
||||
tag = 'newhosp';
|
||||
tablerec = 'myhosps';
|
||||
}
|
||||
let eventobj = await tools.getAnnuncioForTelegram(recnotif.myrectableorig, tablerec, mydescr, userorig, true);
|
||||
newdescr = eventobj.newdescr;
|
||||
// newdescr = eventobj.descrperNotif;
|
||||
recnotif.textcontent_Telegram = eventobj.newdescrtelegram;
|
||||
recnotif.linkaddTelegram = '';
|
||||
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_EVENTS) {
|
||||
@@ -249,7 +251,7 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
|
||||
if (recnotif.typeid === shared_consts.TypeNotifs.ID_EVENTS_NEW_REC) {
|
||||
// let eventobj = await tools.getEventForTelegram(recnotif.myrectableorig, mydescr, userorig);
|
||||
let eventobj = await tools.getAnnuncioForTelegram(recnotif.myrectableorig, shared_consts.TABLES_MYBACHECAS, mydescr, userorig, true);
|
||||
newdescr = eventobj.newdescr;
|
||||
newdescr = eventobj.descrperNotif;
|
||||
newdescrtelegram = eventobj.newdescrtelegram;
|
||||
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_EVENTS_SEND_MSG) {
|
||||
newdescr = i18n.__('EVENT_SEND_MSG', userorig, recnotif.title, recnotif.msg);
|
||||
@@ -597,10 +599,11 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
|
||||
|
||||
recnotif.tag = recnotif.tag ? recnotif.tag : tag;
|
||||
|
||||
if (!recnotif.descr) {
|
||||
if (!recnotif.descr) {
|
||||
recnotif.descr = newdescr;
|
||||
}
|
||||
|
||||
|
||||
return recnotif;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
|
||||
@@ -822,6 +822,19 @@ UserSchema.statics.findByCredentials = function (idapp, username, password, pwdc
|
||||
} else {
|
||||
return !user.deleted || (user.deleted && user.subaccount) ? user : null;
|
||||
}
|
||||
}).then((user) => {
|
||||
if (!user) {
|
||||
// Check with username telegram
|
||||
return User.findOne({
|
||||
idapp,
|
||||
'profile.username_telegram': username.toLowerCase(),
|
||||
$or: [
|
||||
{ deleted: { $exists: false } },
|
||||
{ deleted: { $exists: true, $eq: false } }],
|
||||
});
|
||||
} else {
|
||||
return !user.deleted || (user.deleted && user.subaccount) ? user : null;
|
||||
}
|
||||
}).then(user => {
|
||||
if (!user)
|
||||
return null;
|
||||
|
||||
@@ -132,38 +132,43 @@ module.exports = {
|
||||
});
|
||||
},
|
||||
|
||||
sendEmail_Normale: async function (to, subject, html, replyTo) {
|
||||
sendEmail_Normale: async function (mylocalsconf, to, subject, html, replyTo) {
|
||||
|
||||
// setup e-mail data with unicode symbols
|
||||
var mailOptions = {
|
||||
from: tools.getEmailByIdApp(mylocalsconf.idapp), // sender address
|
||||
dataemail: await this.getdataemail(idapp),
|
||||
to: to,
|
||||
generateTextFromHTML: true,
|
||||
subject: subject,
|
||||
html: html,
|
||||
};
|
||||
try {
|
||||
// setup e-mail data with unicode symbols
|
||||
var mailOptions = {
|
||||
from: tools.getEmailByIdApp(mylocalsconf.idapp), // sender address
|
||||
dataemail: await this.getdataemail(mylocalsconf.idapp),
|
||||
to: to,
|
||||
generateTextFromHTML: true,
|
||||
subject: subject,
|
||||
html: html,
|
||||
};
|
||||
|
||||
if (replyTo)
|
||||
mailOptions['reply-to'] = replyTo;
|
||||
if (replyTo)
|
||||
mailOptions['reply-to'] = replyTo;
|
||||
|
||||
const smtpTransport = this.getTransport(mylocalsconf);
|
||||
const smtpTransport = this.getTransport(mylocalsconf);
|
||||
|
||||
if (process.env.SEND_EMAIL === '1') {
|
||||
// console.log("SEND EMAIL...");
|
||||
// send mail with defined transport object
|
||||
smtpTransport.sendMail(mailOptions, function (error, response) {
|
||||
if (error) {
|
||||
console.log('Email Inviata ERRORE RISPOSTA: ' + error);
|
||||
} else {
|
||||
// console.log("Email Inviata RISPOSTA: " + response);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (process.env.PROVA_EMAIL_TEMPLATE !== '1')
|
||||
previewEmail(mailOptions).then(console.log).catch(console.error);
|
||||
else
|
||||
transport_preview.sendMail(mailOptions).then(console.log).catch(console.error);
|
||||
if (process.env.SEND_EMAIL === '1') {
|
||||
// console.log("SEND EMAIL...");
|
||||
// send mail with defined transport object
|
||||
smtpTransport.sendMail(mailOptions, function (error, response) {
|
||||
if (error) {
|
||||
console.log('Email Inviata ERRORE RISPOSTA: ' + error);
|
||||
} else {
|
||||
// console.log("Email Inviata RISPOSTA: " + response);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (process.env.PROVA_EMAIL_TEMPLATE !== '1')
|
||||
previewEmail(mailOptions).then(console.log).catch(console.error);
|
||||
else
|
||||
transport_preview.sendMail(mailOptions).then(console.log).catch(console.error);
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error('Errore Sendmail', e);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -497,27 +502,31 @@ module.exports = {
|
||||
|
||||
sendEmail_ByText: async function (lang, emailto, user, idapp, rec) {
|
||||
|
||||
tools.mylog('sendEmail_ByText');
|
||||
try {
|
||||
tools.mylog('sendEmail_ByText');
|
||||
|
||||
let mylocalsconf = {
|
||||
idapp,
|
||||
dataemail: await this.getdataemail(idapp),
|
||||
locale: lang,
|
||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||
usernameorig: user.name + ' ' + user.surname,
|
||||
};
|
||||
let mylocalsconf = {
|
||||
idapp,
|
||||
dataemail: await this.getdataemail(idapp),
|
||||
locale: lang,
|
||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||
usernameorig: user.name + ' ' + user.surname,
|
||||
};
|
||||
|
||||
mylocalsconf = this.setParamsForTemplate(user, mylocalsconf);
|
||||
mylocalsconf.emailto = emailto;
|
||||
mylocalsconf = this.setParamsForTemplate(user, mylocalsconf);
|
||||
mylocalsconf.emailto = emailto;
|
||||
|
||||
mylocalsconf.dataemail.emailbody = rec.emailbody;
|
||||
mylocalsconf.dataemail.emailtitle = rec.emailtitle;
|
||||
mylocalsconf.dataemail.emailbody = rec.emailbody;
|
||||
mylocalsconf.dataemail.emailtitle = rec.emailtitle;
|
||||
|
||||
if (!!mylocalsconf.dataemail.emailtitle && !!mylocalsconf.dataemail.emailbody) {
|
||||
const replyto = tools.getreplyToEmailByIdApp(idapp);
|
||||
if (!!mylocalsconf.dataemail.emailtitle && !!mylocalsconf.dataemail.emailbody) {
|
||||
const replyto = tools.getreplyToEmailByIdApp(idapp);
|
||||
|
||||
//return this.sendEmail_base('standard', emailto, mylocalsconf, replyto);
|
||||
return await this.sendEmail_Normale(emailto, mylocalsconf.dataemail.emailtitle, mylocalsconf.dataemail.emailbody, replyto);
|
||||
//return this.sendEmail_base('standard', emailto, mylocalsconf, replyto);
|
||||
return await this.sendEmail_Normale(mylocalsconf, emailto, mylocalsconf.dataemail.emailtitle, mylocalsconf.dataemail.emailbody, replyto);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Errore sendEmail_ByText', e);
|
||||
}
|
||||
|
||||
// Send Email also to the Admin
|
||||
@@ -547,7 +556,7 @@ module.exports = {
|
||||
const replyto = tools.getreplyToEmailByIdApp(idapp);
|
||||
|
||||
//return this.sendEmail_base('standard', emailto, mylocalsconf, replyto);
|
||||
return await this.sendEmail_Normale(emailto, mylocalsconf.dataemail.emailtitle, mylocalsconf.dataemail.emailbody, replyto);
|
||||
return await this.sendEmail_Normale(mylocalsconf, emailto, mylocalsconf.dataemail.emailtitle, mylocalsconf.dataemail.emailbody, replyto);
|
||||
}
|
||||
|
||||
// Send Email also to the Admin
|
||||
|
||||
@@ -1185,6 +1185,9 @@ module.exports = {
|
||||
|
||||
let arrris = [];
|
||||
|
||||
const userOrig = await User.findOne({ idapp, username: usernameOrig },
|
||||
{ _id: 1, lang: 1, aportador_solidario: 1, name: 1, surname: 1, username: 1 });
|
||||
|
||||
const user = await User.findOne({ idapp, username: usernameDest },
|
||||
{ _id: 1, lang: 1 });
|
||||
|
||||
@@ -1238,9 +1241,31 @@ module.exports = {
|
||||
if (mycircuit && mycircuit.askManagerToEnter) {
|
||||
cmdrichiesta = shared_consts.CallFunz.RICHIESTA_CIRCUIT;
|
||||
}
|
||||
|
||||
|
||||
telegrambot.askConfirmationUser(idapp, cmdrichiesta, myuserdata, usernameDest, circuitname,
|
||||
myreccircuit._id, '', extrarec.groupname);
|
||||
|
||||
if (mycircuit.sendEmailAfterAskingToEnter) {
|
||||
const { Circuit } = require('../models/circuit');
|
||||
|
||||
const path = await Circuit.getPathByCircuitName(idapp, circuitname);
|
||||
let myapp = this.getHostByIdApp(idapp);
|
||||
let linkcirc = myapp + path;
|
||||
let messaggio = '';
|
||||
let mytitle = i18n.__('CIRCUIT_REQUEST_TO_ENTER_ASKMANAGER_TITLE', usernameOrig);
|
||||
messaggio = i18n.__('CIRCUIT_REQUEST_TO_ENTER_ASKMANAGER_SHORT', usernameOrig, '<strong>' + circuitname + '</strong>', numuserincircuit, userOrig.aportador_solidario);
|
||||
messaggio += '\n\n';
|
||||
messaggio += '<a href="' + linkcirc + '" target="_blank">Clicca qui per entrare sul Circuito</a>\n';
|
||||
|
||||
const sendemail = require('../sendemail');
|
||||
|
||||
const email = myuserdata.email;
|
||||
|
||||
sendemail.sendEmail_ByText(lang, email, myuserdata, idapp, {
|
||||
emailbody: messaggio,
|
||||
emailtitle: mytitle,
|
||||
})
|
||||
}
|
||||
onlysave = false;
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.ADDADMIN) {
|
||||
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_ADDED_ADMIN;
|
||||
@@ -4950,10 +4975,12 @@ module.exports = {
|
||||
return '🗓 ' + mystr;
|
||||
},
|
||||
|
||||
getDoveStrByEvent(myrec) {
|
||||
getDoveStrByAnnuncio(myrec) {
|
||||
let dove = '🏠 ';
|
||||
if (myrec.mycities && myrec.mycities.length > 0) {
|
||||
dove += myrec.mycities[0].comune + ' (' + myrec.mycities[0].prov + ')'
|
||||
dove += myrec.mycities.map(city => {
|
||||
return `${city.comune} (${city.prov})`;
|
||||
}).join(', ');
|
||||
}
|
||||
return dove;
|
||||
},
|
||||
@@ -4971,7 +4998,7 @@ module.exports = {
|
||||
async getEventForTelegram(myrec, mydescr, userorig) {
|
||||
try {
|
||||
let datastr = this.getstrDateTimeEvent(myrec);
|
||||
let dovestr = this.getDoveStrByEvent(myrec);
|
||||
let dovestr = this.getDoveStrByAnnuncio(myrec);
|
||||
let descrestesa = await this.getDescrEstesaStrByEvent(myrec);
|
||||
let organizedby = myrec.organisedBy;
|
||||
let contributo = myrec.contribstr;
|
||||
@@ -5259,6 +5286,8 @@ module.exports = {
|
||||
|
||||
let img = '';
|
||||
|
||||
let descrperNotif = '';
|
||||
|
||||
if ((tablerec === shared_consts.TABLES_MYGOODS) || (tablerec === shared_consts.TABLES_MYSKILLS)) {
|
||||
iconascambio = this.getIconByAdType(myrec.adType);
|
||||
if (myrec.adType === shared_consts.AdType.OFFRO)
|
||||
@@ -5284,12 +5313,20 @@ module.exports = {
|
||||
|
||||
if (tablerec === shared_consts.TABLES_MYGOODS) {
|
||||
newdescr = i18n.__('Good', userorig, mydescr);
|
||||
descrperNotif = i18n.__('Good: %', mydescr);
|
||||
} else if (tablerec === shared_consts.TABLES_MYSKILLS) {
|
||||
newdescr = i18n.__('Service', userorig, mydescr);
|
||||
descrperNotif = i18n.__('Service: %', mydescr);
|
||||
} else if (tablerec === shared_consts.TABLES_MYHOSPS) {
|
||||
newdescr = i18n.__('Hosp', userorig, mydescr);
|
||||
descrperNotif = i18n.__('Hosp %s', userorig, mydescr);
|
||||
} else if (tablerec === shared_consts.TABLES_MYBACHECAS) {
|
||||
newdescr = i18n.__('Event', userorig, mydescr);
|
||||
let dovestr = this.getDoveStrByAnnuncio(myrec);
|
||||
descrperNotif = i18n.__('NEW_EVENT', userorig, datastr, mydescr, dovestr);
|
||||
}
|
||||
|
||||
|
||||
let contatto = userorig;
|
||||
let contatto_telegram = '';
|
||||
try {
|
||||
@@ -5422,7 +5459,7 @@ module.exports = {
|
||||
|
||||
// out += i18n.__('ADDED_FROM', );
|
||||
|
||||
return { newdescr, newdescrtelegram: out, img };
|
||||
return { newdescr, newdescrtelegram: out, img, descrperNotif };
|
||||
} catch (e) {
|
||||
console.error('Error', e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user