Il creatore del Gruppo deve già appartenere al Gruppo stesso
Non permettere di aggiungere un Gruppo con lo stesso nome o codice quando cancelli un Gruppo, cancella anche tutti i riferimenti sugli utenti di quel gruppo. Errore caricamento Immagini !
This commit is contained in:
@@ -4,6 +4,8 @@ span Username:
|
||||
strong #{username}<br>
|
||||
span Email:
|
||||
strong #{emailto}<br>
|
||||
span Invitante:
|
||||
strong #{aportador_solidario}<br>
|
||||
span Nome:
|
||||
strong #{user.name}<br>
|
||||
span Cognome:
|
||||
|
||||
@@ -117,7 +117,6 @@ module.exports.executeQueryTable = async function (idapp, params, userreq) {
|
||||
return await Site.findOne({idapp: extrapar}, {name: 1, manageremail: 1, confsite: 1}).lean();
|
||||
}
|
||||
|
||||
|
||||
if (User.isAdmin(userreq.perm)) {
|
||||
const myarr = await Site.find({});
|
||||
|
||||
|
||||
@@ -877,10 +877,18 @@ UserSchema.statics.setVerifiedByAportador = async function(
|
||||
'username': username,
|
||||
};
|
||||
|
||||
const myrec = await User.findOneAndUpdate(myquery,
|
||||
{$set: {'verified_by_aportador': valuebool}}, {new: false});
|
||||
const userver = await User.findOne(myquery, {verified_by_aportador: 1}).lean();
|
||||
|
||||
if (userver.verified_by_aportador !== valuebool) {
|
||||
const myrec = await User.findOneAndUpdate(myquery,
|
||||
{$set: {'verified_by_aportador': valuebool}}, {new: false});
|
||||
|
||||
return !!myrec;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return !!myrec;
|
||||
};
|
||||
|
||||
UserSchema.statics.setnotask_verif = async function(
|
||||
@@ -1404,6 +1412,12 @@ UserSchema.statics.removeFromMyGroups = async function(
|
||||
{$pull: {'profile.mygroups': {groupname: {$in: [groupnameDest]}}}});
|
||||
};
|
||||
|
||||
// Rimuovo il Gruppo per Tutti gli Utenti
|
||||
UserSchema.statics.removeAllUsersFromMyGroups = async function(idapp, groupnameDest) {
|
||||
return User.updateMany({idapp},
|
||||
{$pull: {'profile.mygroups': {groupname: {$in: [groupnameDest]}}}});
|
||||
};
|
||||
|
||||
// Rimuovo la Richiesta di Amicizia
|
||||
UserSchema.statics.removeReqFriend = async function(
|
||||
idapp, username, usernameDest) {
|
||||
@@ -2311,8 +2325,9 @@ UserSchema.statics.getFieldsForSearch = function() {
|
||||
{field: 'profile.revolut', type: tools.FieldType.string},
|
||||
{field: 'profile.link_payment', type: tools.FieldType.string},
|
||||
{field: 'profile.teleg_id', type: tools.FieldType.number},
|
||||
{field: 'profile.username_telegram', type: tools.FieldType.string},
|
||||
{field: 'aportador_solidario', type: tools.FieldType.string}];
|
||||
{field: 'profile.username_telegram', type: tools.FieldType.string}
|
||||
];
|
||||
//{field: 'aportador_solidario', type: tools.FieldType.string}
|
||||
};
|
||||
|
||||
UserSchema.statics.getFieldsForSearchUserFriend = function() {
|
||||
|
||||
@@ -233,7 +233,7 @@ router.post('/testServer', authenticate_noerror, (req, res) => {
|
||||
|
||||
});
|
||||
|
||||
router.post('/settable', authenticate, (req, res) => {
|
||||
router.post('/settable', authenticate, async (req, res) => {
|
||||
const params = req.body;
|
||||
const mytable = globalTables.getTableByTableName(params.table);
|
||||
const mydata = req.body.data;
|
||||
@@ -281,7 +281,7 @@ router.post('/settable', authenticate, (req, res) => {
|
||||
}
|
||||
|
||||
if (shared_consts.TABLES_USER_INCLUDE_MY.includes(params.table)) {
|
||||
if (!mydata.admins) {
|
||||
if (mydata.admins.length <= 0) {
|
||||
// Aggiungi solo se non esistono Admin:
|
||||
mydata.admins = [];
|
||||
const indfind = mydata.admins.findIndex(
|
||||
@@ -314,19 +314,43 @@ router.post('/settable', authenticate, (req, res) => {
|
||||
}
|
||||
}
|
||||
|
||||
const isnewrec = mytablerec.isNew;
|
||||
|
||||
if (params.table === shared_consts.TAB_MYGROUPS && isnewrec) {
|
||||
// Controlla se esiste già con lo stesso nome
|
||||
let alreadyexist = await MyGroup.findOne({idapp, groupname: mydata.groupname});
|
||||
if (alreadyexist) {
|
||||
return res.send({code: server_constants.RIS_CODE_REC_ALREADY_EXIST_CODE });
|
||||
}
|
||||
alreadyexist = await MyGroup.findOne({idapp, title: mydata.title});
|
||||
if (alreadyexist) {
|
||||
return res.send({code: server_constants.RIS_CODE_REC_ALREADY_EXIST_NAME });
|
||||
}
|
||||
}
|
||||
|
||||
return mytablerec.save().
|
||||
then(async (rec) => {
|
||||
|
||||
if (shared_consts.TABLES_GETCOMPLETEREC.includes(params.table)) {
|
||||
const myrec = await mytablestrutt.getCompleteRecord(rec.idapp,
|
||||
rec._id);
|
||||
return res.send(myrec);
|
||||
return await mytablestrutt.getCompleteRecord(rec.idapp, rec._id);
|
||||
} else {
|
||||
return res.send(rec);
|
||||
return rec;
|
||||
}
|
||||
|
||||
// tools.mylog('rec', rec);
|
||||
}).then((myrec) => {
|
||||
|
||||
if (params.table === shared_consts.TAB_MYGROUPS && isnewrec) {
|
||||
// nuovo Record:
|
||||
// aggiungi il creatore al gruppo stesso
|
||||
return User.setGroupsCmd(mydata.idapp, req.user.username,
|
||||
myrec.groupname,
|
||||
shared_consts.GROUPSCMD.SETGROUP, true).then((ris) => {
|
||||
return res.send(myrec);
|
||||
});
|
||||
}
|
||||
|
||||
return res.send(myrec);
|
||||
}).catch((e) => {
|
||||
console.error('settable', e.message);
|
||||
if (e.code === 11000) {
|
||||
@@ -880,6 +904,12 @@ router.delete('/delrec/:table/:id', authenticate, async (req, res) => {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (tablename === shared_consts.TAB_MYGROUPS) {
|
||||
// Se è un gruppo, allora cancella anche tutti i suoi riferimenti
|
||||
User.removeAllUsersFromMyGroups(rec.idapp, rec.groupname);
|
||||
}
|
||||
|
||||
cancellato = true;
|
||||
|
||||
tools.mylog('DELETED ', rec._id);
|
||||
@@ -1315,7 +1345,7 @@ router.post('/upload_from_other_server/:dir', authenticate, (req, res) => {
|
||||
function uploadFile(req, res, version) {
|
||||
// console.log('/upload dir:' + dir);
|
||||
const dir = tools.invertescapeslash(req.params.dir);
|
||||
const idapp = req.body.idapp;
|
||||
const idapp = req.user.idapp;
|
||||
|
||||
const form = new formidable.IncomingForm();
|
||||
|
||||
@@ -1370,44 +1400,47 @@ function uploadFile(req, res, version) {
|
||||
// Move in the folder application !
|
||||
// tools.move(oldpath, newname, (err) => {
|
||||
tools.move(oldpath, newname, (err) => {
|
||||
if (err)
|
||||
if (err) {
|
||||
console.log('err:', err);
|
||||
res.status(400).send();
|
||||
} else {
|
||||
|
||||
// Salva le immagini in formato compresso
|
||||
try {
|
||||
let resized_img_small = tools.extractFilePath(newname) + '/' +
|
||||
server_constants.PREFIX_IMG_SMALL +
|
||||
tools.extractFileName(newname);
|
||||
// SMALL
|
||||
sharp(newname).
|
||||
resize(64, 64).
|
||||
toFile(resized_img_small);
|
||||
// Salva le immagini in formato compresso
|
||||
try {
|
||||
let resized_img_small = tools.extractFilePath(newname) + '/' +
|
||||
server_constants.PREFIX_IMG_SMALL +
|
||||
tools.extractFileName(newname);
|
||||
// SMALL
|
||||
sharp(newname).
|
||||
resize(64, 64).
|
||||
toFile(resized_img_small);
|
||||
|
||||
// MEDIUM
|
||||
let resized_img = tools.extractFilePath(newname) + '/' +
|
||||
server_constants.PREFIX_IMG + tools.extractFileName(newname);
|
||||
sharp(newname).
|
||||
resize(512, 512).
|
||||
toFile(resized_img, function(err) {
|
||||
// MEDIUM
|
||||
let resized_img = tools.extractFilePath(newname) + '/' +
|
||||
server_constants.PREFIX_IMG + tools.extractFileName(newname);
|
||||
sharp(newname).
|
||||
resize(512, 512).
|
||||
toFile(resized_img, function(err) {
|
||||
|
||||
if (tools.isFileExists(resized_img)) {
|
||||
// DELETE THE ORIGINAL BIG
|
||||
tools.delete(newname, false, () => {});
|
||||
if (tools.isFileExists(resized_img)) {
|
||||
// DELETE THE ORIGINAL BIG
|
||||
tools.delete(newname, false, () => {});
|
||||
|
||||
// RENAME THE MEDIUM IN THE ORIGINAL NAME
|
||||
tools.move(resized_img, newname, (err) => {
|
||||
if (err)
|
||||
console.error('err', err);
|
||||
else
|
||||
console.log('move', newname);
|
||||
});
|
||||
}
|
||||
// RENAME THE MEDIUM IN THE ORIGINAL NAME
|
||||
tools.move(resized_img, newname, (err) => {
|
||||
if (err)
|
||||
console.error('err', err);
|
||||
else
|
||||
console.log('move', newname);
|
||||
});
|
||||
}
|
||||
|
||||
if (err)
|
||||
console.error('Error Upload: ', err);
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('newname', e);
|
||||
if (err)
|
||||
console.error('Error Upload: ', err);
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('newname', e);
|
||||
}
|
||||
}
|
||||
|
||||
res.end();
|
||||
|
||||
@@ -23,6 +23,8 @@ const { Newstosent } = require('./models/newstosent');
|
||||
|
||||
const server_constants = require('./tools/server_constants');
|
||||
|
||||
const shared_consts = require('./tools/shared_nodejs');
|
||||
|
||||
const { User } = require('./models/user');
|
||||
|
||||
const transport_preview = nodemailer.createTransport({
|
||||
@@ -190,14 +192,13 @@ module.exports = {
|
||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||
strlinksito: tools.getHostByIdApp(idapp),
|
||||
strlinkreg: this.getlinkReg(idapp, idreg),
|
||||
username: user.username,
|
||||
name: user.name,
|
||||
surname: user.surname,
|
||||
forgetpwd: tools.getHostByIdApp(idapp) + '/requestresetpwd',
|
||||
emailto: emailto,
|
||||
user,
|
||||
};
|
||||
|
||||
mylocalsconf = this.setParamsForTemplate(user, mylocalsconf);
|
||||
|
||||
this.sendEmail_base(tools.getpathregByIdApp(idapp, lang), emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp));
|
||||
|
||||
// Send to the Admin an Email
|
||||
@@ -208,8 +209,10 @@ module.exports = {
|
||||
if (tools.getConfSiteOptionEnabledByIdApp(mylocalsconf.idapp, shared_consts.ConfSite.Notif_Reg_Push_Admin)) {
|
||||
const nometot = tools.getNomeCognomeEUserNameByUser(mylocalsconf);
|
||||
|
||||
let aportador = mylocalsconf.aportador_solidario ? ' (da ' + mylocalsconf.aportador_solidario + ')': '';
|
||||
|
||||
const numutenti = await User.getNumUsers(mylocalsconf.idapp);
|
||||
tools.sendNotifToAdmin('++ [' + numutenti + '] ' + nometot);
|
||||
tools.sendNotifToAdmin('++ [' + numutenti + '] ' + nometot + aportador);
|
||||
}
|
||||
|
||||
// if (tools.isManagAndAdminDifferent(idapp)) {
|
||||
@@ -226,15 +229,14 @@ module.exports = {
|
||||
locale: lang,
|
||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||
strlinksito: tools.getHostByIdApp(idapp),
|
||||
username: iscritto.username,
|
||||
name: iscritto.name,
|
||||
surname: iscritto.surname,
|
||||
emailto: emailto,
|
||||
iscritto,
|
||||
metodo_pagamento: tools.getPaymentTypesById(iscritto.metodo_pagamento),
|
||||
data_nascita: tools.getstrDate_DD_MM_YYYY(iscritto.dateofbirth)
|
||||
};
|
||||
|
||||
mylocalsconf = this.setParamsForTemplate(iscritto, mylocalsconf);
|
||||
|
||||
this.sendEmail_base('iscrizione_conacreis/' + lang, emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp));
|
||||
|
||||
// Send to the Admin an Email
|
||||
@@ -256,14 +258,12 @@ module.exports = {
|
||||
dataemail: await this.getdataemail(idapp),
|
||||
locale: lang,
|
||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||
user: user,
|
||||
name: user.name,
|
||||
username: user.username,
|
||||
surname: user.surname,
|
||||
strlinksetpassword: this.getlinkRequestNewPassword(idapp, emailto, tokenforgot),
|
||||
emailto: emailto,
|
||||
};
|
||||
|
||||
mylocalsconf = this.setParamsForTemplate(user, mylocalsconf);
|
||||
|
||||
this.sendEmail_base('resetpwd/' + lang, emailto, mylocalsconf, '');
|
||||
},
|
||||
|
||||
@@ -278,8 +278,6 @@ module.exports = {
|
||||
dataemail: await this.getdataemail(idapp),
|
||||
locale: lang,
|
||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||
name: user.name,
|
||||
surname: user.surname,
|
||||
emailto: emailto,
|
||||
participants: '',
|
||||
participantsLunch: '',
|
||||
@@ -290,6 +288,8 @@ module.exports = {
|
||||
event: recbooking.infoevent,
|
||||
};
|
||||
|
||||
mylocalsconf = this.setParamsForTemplate(user, mylocalsconf);
|
||||
|
||||
return Settings.getValDbSettings(idapp, 'MSG_REPLY_AFTER_BOOKING')
|
||||
.then(async (ris) => {
|
||||
mylocalsconf.msgreply_after_booking = ris;
|
||||
@@ -362,9 +362,6 @@ module.exports = {
|
||||
dataemail: await this.getdataemail(idapp),
|
||||
locale: lang,
|
||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||
name: user.name,
|
||||
surname: user.surname,
|
||||
emailto: emailto,
|
||||
event: recbooking.infoevent,
|
||||
participants: '',
|
||||
participantsLunch: '',
|
||||
@@ -373,6 +370,10 @@ module.exports = {
|
||||
eventtextplain: tools.removeSpecialCharForEmail(recbooking.infoevent),
|
||||
};
|
||||
|
||||
mylocalsconf = this.setParamsForTemplate(user, mylocalsconf);
|
||||
|
||||
mylocalsconf.emailto = emailto;
|
||||
|
||||
mylocalsconf = await this.preparaConfPerBooking(res, idapp, mylocalsconf, recbooking, 'Cancellazione');
|
||||
|
||||
let msgtelegram = 'Cancellazione Evento [' + mylocalsconf.name + ' (' + mylocalsconf.name + ' ' + mylocalsconf.surname + ')] ' + mylocalsconf.eventtextplain;
|
||||
@@ -399,15 +400,15 @@ module.exports = {
|
||||
dataemail: await this.getdataemail(idapp),
|
||||
locale: lang,
|
||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||
name: user.name,
|
||||
surname: user.surname,
|
||||
usernameorig: user.name + ' ' + user.surname,
|
||||
emailto: emailto,
|
||||
message: tools.convertTexttoHtml(recmsg.message),
|
||||
infoevent: recmsg.source.infoevent,
|
||||
strlinkreply: tools.getHostByIdApp(idapp) + '/messages/' + recmsg._id
|
||||
};
|
||||
|
||||
mylocalsconf = this.setParamsForTemplate(user, mylocalsconf);
|
||||
mylocalsconf.emailto = emailto;
|
||||
|
||||
let replyto = '';
|
||||
if (mylocalsconf.infoevent !== '')
|
||||
replyto = user.email;
|
||||
@@ -424,17 +425,17 @@ module.exports = {
|
||||
|
||||
tools.mylog('sendEmail_ByText');
|
||||
|
||||
mylocalsconf = {
|
||||
let mylocalsconf = {
|
||||
idapp,
|
||||
dataemail: await this.getdataemail(idapp),
|
||||
locale: lang,
|
||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||
name: user.name,
|
||||
surname: user.surname,
|
||||
usernameorig: user.name + ' ' + user.surname,
|
||||
emailto: emailto,
|
||||
};
|
||||
|
||||
mylocalsconf = this.setParamsForTemplate(user, mylocalsconf);
|
||||
mylocalsconf.emailto = emailto;
|
||||
|
||||
mylocalsconf.dataemail.emailbody = rec.emailbody;
|
||||
mylocalsconf.dataemail.emailtitle = rec.emailtitle;
|
||||
|
||||
@@ -453,16 +454,15 @@ module.exports = {
|
||||
|
||||
// console.log('idapp', idapp, tools.getNomeAppByIdApp(idapp));
|
||||
|
||||
mylocalsconf = {
|
||||
let mylocalsconf = {
|
||||
idapp,
|
||||
dataemail: await this.getdataemail(idapp),
|
||||
locale: lang,
|
||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||
name: user.name,
|
||||
surname: user.surname,
|
||||
emailto: user.email,
|
||||
};
|
||||
|
||||
mylocalsconf = this.setParamsForTemplate(user, mylocalsconf);
|
||||
|
||||
const hash = tools.getHash(mylocalsconf.emailto);
|
||||
|
||||
// Check if exist to the Mailing List
|
||||
@@ -553,6 +553,7 @@ module.exports = {
|
||||
out = out.replace('{username}', mylocalsconf.username);
|
||||
out = out.replace('{name}', mylocalsconf.name ? mylocalsconf.name : mylocalsconf.username);
|
||||
out = out.replace('{surname}', mylocalsconf.surname ? mylocalsconf.surname : '');
|
||||
out = out.replace('{aportador_solidario}', mylocalsconf.aportador_solidario ? mylocalsconf.aportador_solidario : '');
|
||||
|
||||
return out
|
||||
},
|
||||
@@ -645,6 +646,25 @@ module.exports = {
|
||||
return smtpTransport;
|
||||
},
|
||||
|
||||
setParamsForTemplate: function (user, mylocalsconf){
|
||||
|
||||
try {
|
||||
mylocalsconf.username = user.username;
|
||||
mylocalsconf.name = user.name;
|
||||
mylocalsconf.surname = user.surname;
|
||||
mylocalsconf.aportador_solidario = user.aportador_solidario ? user.aportador_solidario : '';
|
||||
mylocalsconf.emailto = user.email;
|
||||
mylocalsconf.hashemail = tools.getHash(user.email);
|
||||
mylocalsconf.user = user;
|
||||
|
||||
mylocalsconf = this.replacefields(mylocalsconf);
|
||||
}catch (e) {
|
||||
console.error('setParamsForTemplate', e);
|
||||
}
|
||||
|
||||
return mylocalsconf;
|
||||
},
|
||||
|
||||
sendEmail_OrderProduct: async function (lang, idapp, orders, user) {
|
||||
|
||||
const msginizio = 'Ordine n: ' + orders.numorder + ' ' + user.name + ' ' + user.surname;
|
||||
@@ -652,7 +672,7 @@ module.exports = {
|
||||
|
||||
await telegrambot.sendMsgTelegramToTheManagers(idapp, msginizio);
|
||||
|
||||
mylocalsconf = {
|
||||
let mylocalsconf = {
|
||||
idapp,
|
||||
locale: lang,
|
||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||
@@ -663,12 +683,7 @@ module.exports = {
|
||||
user
|
||||
};
|
||||
|
||||
mylocalsconf.name = user.name;
|
||||
mylocalsconf.surname = user.surname;
|
||||
mylocalsconf.emailto = user.email;
|
||||
mylocalsconf.hashemail = tools.getHash(user.email);
|
||||
|
||||
mylocalsconf = this.replacefields(mylocalsconf);
|
||||
mylocalsconf = this.setParamsForTemplate(user, mylocalsconf);
|
||||
|
||||
this.sendEmail_base_e_manager(idapp, 'ecommerce/makeorder/' + lang, mylocalsconf.emailto, mylocalsconf, mylocalsconf.dataemail.email_reply);
|
||||
|
||||
@@ -680,7 +695,7 @@ module.exports = {
|
||||
|
||||
await telegrambot.sendMsgTelegramToTheManagers(idapp, msginizio);
|
||||
|
||||
mylocalsconf = {
|
||||
let mylocalsconf = {
|
||||
idapp,
|
||||
locale: lang,
|
||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||
@@ -691,12 +706,7 @@ module.exports = {
|
||||
user
|
||||
};
|
||||
|
||||
mylocalsconf.name = user.name;
|
||||
mylocalsconf.surname = user.surname;
|
||||
mylocalsconf.emailto = user.email;
|
||||
mylocalsconf.hashemail = tools.getHash(user.email);
|
||||
|
||||
mylocalsconf = this.replacefields(mylocalsconf);
|
||||
mylocalsconf = this.setParamsForTemplate(user, mylocalsconf);
|
||||
|
||||
if ((status !== shared_consts.OrderStatus.CANCELED) && (status !== shared_consts.OrderStatus.RECEIVED)) {
|
||||
const esito = this.sendEmail_base('ecommerce/' + ordertype + '/' + lang, mylocalsconf.emailto, mylocalsconf, mylocalsconf.dataemail.email_reply);
|
||||
@@ -722,7 +732,7 @@ module.exports = {
|
||||
|
||||
const myarrevents = await MyEvent.getLastEvents(idapp);
|
||||
|
||||
mylocalsconf = {
|
||||
let mylocalsconf = {
|
||||
idapp,
|
||||
locale: lang,
|
||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||
@@ -765,13 +775,7 @@ module.exports = {
|
||||
return false
|
||||
}
|
||||
|
||||
mylocalsconf.name = user.name;
|
||||
mylocalsconf.surname = user.surname;
|
||||
mylocalsconf.emailto = user.email;
|
||||
mylocalsconf.hashemail = tools.getHash(user.email);
|
||||
|
||||
mylocalsconf = this.replacefields(mylocalsconf);
|
||||
|
||||
mylocalsconf = this.setParamsForTemplate(user, mylocalsconf);
|
||||
|
||||
// If has already sent, don't send it again!
|
||||
if (user.lastid_newstosent !== id_newstosent.toString()) {
|
||||
@@ -886,7 +890,7 @@ module.exports = {
|
||||
const myarrevents = await MyEvent.getLastEvents(idapp);
|
||||
const myemail = await Settings.getValDbSettings(idapp, 'EMAIL_TEST');
|
||||
if (myemail) {
|
||||
mylocalsconf = {
|
||||
let mylocalsconf = {
|
||||
idapp,
|
||||
locale: lang,
|
||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||
|
||||
@@ -467,7 +467,8 @@ const txt = {
|
||||
''+
|
||||
'(🆘 Per Aiuti, guarda il menu qui sotto)\n\n' +
|
||||
''+
|
||||
'😍😍😍 Ora sei pronto per Entrare nella APP!',
|
||||
'😍😍😍 Ora sei pronto per Entrare nella APP!\n' +
|
||||
'👉🏻 Clicca qui: %s',
|
||||
MSG_SET_USERNAME: '✨✨✨✨✨✨✨✨✨✨\n' +
|
||||
'🔑 Devi impostare un Username per Telegram:\n' +
|
||||
'\n' +
|
||||
@@ -486,7 +487,8 @@ const txt = {
|
||||
MSG_APORTADOR_USER_REGISTERED: emo.FIRE + ' Si è appena Registrato "%s" (n. %s)\nInvitato da %s',
|
||||
MSG_APORTADOR_ASK_CONFIRM: '🆕💥 🧍♂️ Abilita Nuova Registrazione: %s',
|
||||
MSG_APORTADOR_CONFIRMED: '✅ %s è stato Abilitato correttamente!',
|
||||
MSG_APORTADOR_DEST_CONFIRMED: '✅ Sei stato Abilitato correttamente da %s!',
|
||||
MSG_APORTADOR_DEST_CONFIRMED: '✅ Sei stato Abilitato correttamente da %s!\n' +
|
||||
'Vai sulla App oppure clicca qui per entrare\n👉🏻 %s',
|
||||
MSG_APORTADOR_DEST_NOT_CONFIRMED: emo.EXCLAMATION_MARK +
|
||||
'🚫 Ci dispiace ma non sei stato Verificato correttamente dal tuo invitante %s.<br>Contattalo per farti abilitare !',
|
||||
MSG_APORTADOR_NOT_CONFIRMED: emo.EXCLAMATION_MARK +
|
||||
@@ -653,7 +655,8 @@ const txt_pt = {
|
||||
MSG_APORTADOR_USER_REGISTERED: emo.FIRE +
|
||||
' Acabou de se registar "%s (n. %s)"\n(Convidado por %s)',
|
||||
MSG_APORTADOR_ASK_CONFIRM: '🆕💥 🧍♂️ Abilita Nuova Registrazione: %s',
|
||||
MSG_APORTADOR_CONFIRMED: '✅ %s è stato Abilitato correttamente!',
|
||||
MSG_APORTADOR_CONFIRMED: '✅ %s è stato Abilitato correttamente!' +
|
||||
'Vai sulla App oppure clicca qui per entrare 👉🏻 %s',
|
||||
MSG_APORTADOR_DEST_CONFIRMED: '✅ Sei stato Abilitato correttamente da %s!',
|
||||
MSG_APORTADOR_DEST_NOT_CONFIRMED: emo.EXCLAMATION_MARK +
|
||||
'🚫 Ci dispiace ma non sei stato Verificato correttamente dal tuo invitante %s.<br>Contattalo per farti abilitare !',
|
||||
@@ -1469,6 +1472,7 @@ class Telegram {
|
||||
msg = msg.replace('{username}', user.username);
|
||||
msg = msg.replace('{name}', user.name ? user.name : user.username);
|
||||
msg = msg.replace('{surname}', user.surname ? user.surname : '');
|
||||
msg = msg.replace('{aportador}', user.aportador_solidario ? user.aportador_solidario : '');
|
||||
if (!!user.profile.link_payment)
|
||||
msg = msg.replace('{link_paypalme}', user.profile.link_payment);
|
||||
if (!!user.profile.revolut)
|
||||
@@ -2527,7 +2531,7 @@ class Telegram {
|
||||
if (recuser) {
|
||||
let name = recuser.name;
|
||||
this.sendMsg(msg.from.id,
|
||||
printf(getstr(recuser.lang, 'MSG_VERIFY_OK'), name));
|
||||
printf(getstr(recuser.lang, 'MSG_VERIFY_OK'), name, tools.getHostByIdApp(this.idapp)));
|
||||
|
||||
this.checkIfUsernameTelegramSet(msg, recuser);
|
||||
// local_sendMsgTelegramToTheManagers(this.idapp, recuser.name + ' ' + recuser.surname + ' si è Verificato a Telegram BOT! (lang=' + recuser.lang + ')' + emo.STARS, msg);
|
||||
@@ -3573,33 +3577,44 @@ if (true) {
|
||||
|
||||
} else if (data.action === InlineConferma.RISPOSTA_SI +
|
||||
shared_consts.CallFunz.REGISTRATION) {
|
||||
await myclTelegram.setCmdToUsername(rec, data.username,
|
||||
const changed = await myclTelegram.setCmdToUsername(rec, data.username,
|
||||
Cmd.VALIDATE_REGISTRATION, true);
|
||||
|
||||
await User.setFriendsCmd(user.idapp, data.username, userDest.username, shared_consts.FRIENDSCMD.SETFRIEND);
|
||||
|
||||
const msgOrig = printf(
|
||||
getstr(userDest.lang, 'MSG_APORTADOR_DEST_CONFIRMED'),
|
||||
`${userDest.username}`);
|
||||
const msgDest = printf(
|
||||
getstr(user.lang, 'MSG_APORTADOR_CONFIRMED'),
|
||||
`${user.username}`);
|
||||
if (changed) {
|
||||
const msgOrig = printf(
|
||||
getstr(userDest.lang, 'MSG_APORTADOR_DEST_CONFIRMED'), `${userDest.username}`, tools.getHostByIdApp(user.idapp));
|
||||
const msgDest = printf(
|
||||
getstr(user.lang, 'MSG_APORTADOR_CONFIRMED'), `${user.username}`);
|
||||
|
||||
await local_sendMsgTelegram(user.idapp, data.username, msgOrig);
|
||||
await local_sendMsgTelegram(user.idapp, data.userDest, msgDest);
|
||||
await local_sendMsgTelegram(user.idapp, data.username,
|
||||
msgOrig);
|
||||
await local_sendMsgTelegram(user.idapp, data.userDest,
|
||||
msgDest);
|
||||
}
|
||||
|
||||
} else if (data.action === InlineConferma.RISPOSTA_NO + shared_consts.CallFunz.REGISTRATION) {
|
||||
await myclTelegram.setCmdToUsername(rec, data.username,
|
||||
const changed = await myclTelegram.setCmdToUsername(rec, data.username,
|
||||
Cmd.VALIDATE_REGISTRATION, false);
|
||||
|
||||
const nomeDest = tools.getNomeCognomeEUserNameByUser(userDest);
|
||||
const nomestr = tools.getNomeCognomeEUserNameByUser(user);
|
||||
if (changed) {
|
||||
const nomeDest = tools.getNomeCognomeEUserNameByUser(
|
||||
userDest);
|
||||
const nomestr = tools.getNomeCognomeEUserNameByUser(user);
|
||||
|
||||
const msgOrig = printf(getstr(userDest.lang, 'MSG_APORTADOR_DEST_NOT_CONFIRMED', nomeDest));
|
||||
const msgDest = printf(getstr(user.lang, 'MSG_APORTADOR_NOT_CONFIRMED'),nomestr);
|
||||
const msgOrig = printf(
|
||||
getstr(userDest.lang, 'MSG_APORTADOR_DEST_NOT_CONFIRMED',
|
||||
nomeDest));
|
||||
const msgDest = printf(
|
||||
getstr(user.lang, 'MSG_APORTADOR_NOT_CONFIRMED'),
|
||||
nomestr);
|
||||
|
||||
await local_sendMsgTelegram(user.idapp, data.username, msgOrig);
|
||||
await local_sendMsgTelegram(user.idapp, data.userDest, msgDest);
|
||||
await local_sendMsgTelegram(user.idapp, data.username,
|
||||
msgOrig);
|
||||
await local_sendMsgTelegram(user.idapp, data.userDest,
|
||||
msgDest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ const Subscription = mongoose.model('subscribers');
|
||||
|
||||
const server_constants = require('./server_constants');
|
||||
|
||||
|
||||
// SETTINGS WebPush Configuration
|
||||
const webpush = require('web-push');
|
||||
|
||||
@@ -1136,7 +1137,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
getAskToVerifyReg: function(idapp) {
|
||||
return tools.getConfSiteOptionEnabledByIdApp(idapp, shared_consts.ConfSite.Need_Aportador_On_DataReg_To_Verify_Reg);
|
||||
return this.getConfSiteOptionEnabledByIdApp(idapp, shared_consts.ConfSite.Need_Aportador_On_DataReg_To_Verify_Reg);
|
||||
},
|
||||
|
||||
isManagAndAdminDifferent(idapp) {
|
||||
|
||||
@@ -75,7 +75,7 @@ module.exports = {
|
||||
let mytable = '';
|
||||
if (tablename === 'users')
|
||||
mytable = User;
|
||||
else if (tablename === 'mygroups')
|
||||
else if (tablename === shared_consts.TAB_MYGROUPS)
|
||||
mytable = MyGroup;
|
||||
else if (tablename === 'tessitura')
|
||||
mytable = Tessitura;
|
||||
|
||||
@@ -6,6 +6,8 @@ module.exports = Object.freeze({
|
||||
RIS_CODE_EMAIL_ALREADY_VERIFIED: -5,
|
||||
RIS_CODE_EMAIL_VERIFIED: 1,
|
||||
|
||||
RIS_CODE_REC_ALREADY_EXIST_CODE: -101,
|
||||
RIS_CODE_REC_ALREADY_EXIST_NAME: -100,
|
||||
RIS_CODE_USER_APORTADOR_NOT_VALID: -75,
|
||||
RIS_CODE_USER_EXTRALIST_NOTFOUND: -70,
|
||||
RIS_CODE_USERNAME_ALREADY_EXIST: -60,
|
||||
|
||||
Reference in New Issue
Block a user