Se la window viene attivata, e se sono in fase di registrazione, allora controllo se ci sono aggiornamenti ogni 10 secondi, loadSite
Corretto che il link di registrazione se era in minuscolo l'username e venivi registrato in maiuscolo, non lo prendeva. L'immagine di telegram occorre salvare anche la versione SMALL Corretto filtro, se cambiavo Regione, non mi resettava la Provincia e la Città
This commit is contained in:
@@ -70,14 +70,22 @@ MsgTemplateSchema.statics.executeQueryTable = function (idapp, params) {
|
|||||||
return tools.executeQueryTable(this, idapp, params);
|
return tools.executeQueryTable(this, idapp, params);
|
||||||
};
|
};
|
||||||
|
|
||||||
MsgTemplateSchema.statics.getMsgByLang = async function (idapp, typemsg, lang) {
|
MsgTemplateSchema.statics.getMsgByLang = async function (idapp, myuser, typemsg, lang) {
|
||||||
const MsgTemplate = this;
|
const MsgTemplate = this;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const mymsg = await MsgTemplate.findOne({ idapp, typemsg });
|
const mymsg = await MsgTemplate.findOne({ idapp, typemsg });
|
||||||
if (!!mymsg) {
|
if (!!mymsg) {
|
||||||
if ((!!mymsg["msg_" + lang]) && (!!mymsg["title_" + lang])) {
|
if ((!!mymsg["msg_" + lang]) && (!!mymsg["title_" + lang])) {
|
||||||
return { body: mymsg["msg_" + lang], title: mymsg["title_" + lang] }
|
let body = mymsg["msg_" + lang]
|
||||||
|
let title = mymsg["title_" + lang]
|
||||||
|
if (!body) {
|
||||||
|
body = mymsg["msg_it"]
|
||||||
|
title = mymsg["title_it"]
|
||||||
|
}
|
||||||
|
body = tools.convertSpecialTags(myuser, body);
|
||||||
|
title = tools.convertSpecialTags(myuser, title);
|
||||||
|
return { body, title }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -2173,13 +2173,34 @@ UserSchema.statics.getNameSurnameByUsername = async function(
|
|||||||
UserSchema.statics.getIdByUsername = async function(idapp, username) {
|
UserSchema.statics.getIdByUsername = async function(idapp, username) {
|
||||||
const User = this;
|
const User = this;
|
||||||
|
|
||||||
|
let regexp = new RegExp(`${username}`, 'i')
|
||||||
|
|
||||||
return User.findOne({
|
return User.findOne({
|
||||||
idapp, username,
|
idapp,
|
||||||
|
username :
|
||||||
|
{ $regex: regexp },
|
||||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||||
}, {username: 1, _id: 1}).then((rec) => {
|
}, {username: 1, _id: 1}).then((rec) => {
|
||||||
return (!!rec) ? rec._id.toString() : '';
|
return (!!rec) ? rec._id.toString() : '';
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.error('getNameSurnameByUsername', e);
|
console.error('getIdByUsername', e);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
UserSchema.statics.getRealUsernameByUsername = async function(idapp, username) {
|
||||||
|
const User = this;
|
||||||
|
|
||||||
|
let regexp = new RegExp(`${username}`, 'i')
|
||||||
|
|
||||||
|
return User.findOne({
|
||||||
|
idapp,
|
||||||
|
username :
|
||||||
|
{ $regex: regexp },
|
||||||
|
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||||
|
}, {username: 1, _id: 1}).then((rec) => {
|
||||||
|
return (!!rec) ? rec.username : '';
|
||||||
|
}).catch((e) => {
|
||||||
|
console.error('getRealUsernameByUsername', e);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ module.exports = {
|
|||||||
{_id: 108, reg: 'CAL', prov: 'VV', descr: 'Vibo Valentia', link_grp: 'https://t.me/c/1614195634/386?thread=384'},
|
{_id: 108, reg: 'CAL', prov: 'VV', descr: 'Vibo Valentia', link_grp: 'https://t.me/c/1614195634/386?thread=384'},
|
||||||
{_id: 109, reg: 'VEN', prov: 'VI', descr: 'Vicenza', link_grp: 'https://t.me/c/1614195634/615?thread=605'},
|
{_id: 109, reg: 'VEN', prov: 'VI', descr: 'Vicenza', link_grp: 'https://t.me/c/1614195634/615?thread=605'},
|
||||||
{_id: 110, reg: 'LAZ', prov: 'VT', descr: 'Viterbo', link_grp: 'https://t.me/c/1614195634/76?thread=74'},
|
{_id: 110, reg: 'LAZ', prov: 'VT', descr: 'Viterbo', link_grp: 'https://t.me/c/1614195634/76?thread=74'},
|
||||||
{_id: 111, reg: 'RSM', prov: 'RSM', descr: 'Repubblica di San Marino', link_grp: ''},
|
{_id: 111, reg: 'RSM', prov: 'RSM', descr: 'Repubblica di San Marino', link_grp: 'https://t.me/+HSdNurm0IXY1MGI0'},
|
||||||
{_id: 112, reg: 'EST', prov: 'EST', descr: 'Estero', link_grp: ''},
|
{_id: 112, reg: 'EST', prov: 'EST', descr: 'Estero', link_grp: ''},
|
||||||
{_id: 113, reg: 'ONL', prov: 'ONL', descr: 'On Line', link_grp: ''},
|
{_id: 113, reg: 'ONL', prov: 'ONL', descr: 'On Line', link_grp: ''},
|
||||||
{_id: 114, reg: 'LAZ', prov: 'RM', descr: 'Roma Nord-Est', link_grp: 'https://t.me/c/1614195634/64?thread=57'},
|
{_id: 114, reg: 'LAZ', prov: 'RM', descr: 'Roma Nord-Est', link_grp: 'https://t.me/c/1614195634/64?thread=57'},
|
||||||
|
|||||||
@@ -1122,12 +1122,11 @@ function load(req, res, version) {
|
|||||||
workers,
|
workers,
|
||||||
internalpages,
|
internalpages,
|
||||||
levels,
|
levels,
|
||||||
skills,
|
skills, //25
|
||||||
//subSkills,
|
//subSkills,
|
||||||
myuserextra,
|
myuserextra, // 26
|
||||||
sectors,
|
sectors, // 27
|
||||||
statusSkills,
|
statusSkills, //28
|
||||||
provinces,
|
|
||||||
// cities,
|
// cities,
|
||||||
provinces,
|
provinces,
|
||||||
catgrps,
|
catgrps,
|
||||||
|
|||||||
@@ -228,6 +228,10 @@ router.post('/', async (req, res) => {
|
|||||||
let recextra = null;
|
let recextra = null;
|
||||||
|
|
||||||
const id_aportador = await User.getIdByUsername(user.idapp, user.aportador_solidario);
|
const id_aportador = await User.getIdByUsername(user.idapp, user.aportador_solidario);
|
||||||
|
if (id_aportador) {
|
||||||
|
user.aportador_solidario = await User.getRealUsernameByUsername(user.idapp, user.aportador_solidario);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!id_aportador && tools.getAskToVerifyReg(body.idapp)) {
|
if (!id_aportador && tools.getAskToVerifyReg(body.idapp)) {
|
||||||
// Si sta tentando di registrare una persona sotto che non corrisponde!
|
// Si sta tentando di registrare una persona sotto che non corrisponde!
|
||||||
|
|||||||
@@ -804,8 +804,8 @@ const MyTelegramBot = {
|
|||||||
|
|
||||||
cl.setPhotoProfile(myuser, telegid, false);
|
cl.setPhotoProfile(myuser, telegid, false);
|
||||||
|
|
||||||
const rismsg = await MsgTemplate.getMsgByLang(idapp, shared_consts.TypeMsgTemplate.MSG_BENVENUTO, myuser.lang);
|
const rismsg = await MsgTemplate.getMsgByLang(idapp, myuser, shared_consts.TypeMsgTemplate.MSG_BENVENUTO, myuser.lang);
|
||||||
const rismsg2 = await MsgTemplate.getMsgByLang(idapp, shared_consts.TypeMsgTemplate.MS_SHARE_LINK, myuser.lang);
|
const rismsg2 = await MsgTemplate.getMsgByLang(idapp, myuser, shared_consts.TypeMsgTemplate.MS_SHARE_LINK, myuser.lang);
|
||||||
|
|
||||||
await cl.sendMsgLog(telegid, rismsg.body);
|
await cl.sendMsgLog(telegid, rismsg.body);
|
||||||
await cl.sendMsg(telegid, rismsg2.body);
|
await cl.sendMsg(telegid, rismsg2.body);
|
||||||
@@ -927,7 +927,7 @@ const MyTelegramBot = {
|
|||||||
}
|
}
|
||||||
msg += mydata.msgpar1;
|
msg += mydata.msgpar1;
|
||||||
} else if (mydata.tipomsg >= 1000) {
|
} else if (mydata.tipomsg >= 1000) {
|
||||||
const ris = await MsgTemplate.getMsgByLang(user.idapp, mydata.tipomsg,
|
const ris = await MsgTemplate.getMsgByLang(user.idapp, user, mydata.tipomsg,
|
||||||
lang);
|
lang);
|
||||||
msg = ris.body;
|
msg = ris.body;
|
||||||
title = ris.title;
|
title = ris.title;
|
||||||
@@ -1086,7 +1086,7 @@ const MyTelegramBot = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tipomsgtempl > 0) {
|
if (tipomsgtempl > 0) {
|
||||||
const rismsg = await MsgTemplate.getMsgByLang(idapp, tipomsgtempl, user.lang);
|
const rismsg = await MsgTemplate.getMsgByLang(idapp, user, tipomsgtempl, user.lang);
|
||||||
params.content = rismsg.body;
|
params.content = rismsg.body;
|
||||||
params.title = rismsg.title;
|
params.title = rismsg.title;
|
||||||
}
|
}
|
||||||
@@ -1398,8 +1398,10 @@ class Telegram {
|
|||||||
|
|
||||||
await this.sendMsgByTemplate('MSG_SET_USERNAME_OK', rec.user);
|
await this.sendMsgByTemplate('MSG_SET_USERNAME_OK', rec.user);
|
||||||
|
|
||||||
if (!rec.user.verified_by_aportador) {
|
if (rec.user) {
|
||||||
MyTelegramBot.askConfirmationUser(this.idapp, shared_consts.CallFunz.REGISTRATION, rec.user);
|
if (!rec.user.verified_by_aportador) {
|
||||||
|
MyTelegramBot.askConfirmationUser(this.idapp, shared_consts.CallFunz.REGISTRATION, rec.user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user