Se errore di connessione al Server: compare l'username telegram !
Se Cookie disattivati: non riesci a loggare.
sui Gruppi: non si vede il Comune !
Sei stato accettato da paoloar77 a far parte del Gruppo Terraw. MSG SBAGLIATO
l'immagine dell'amministratore del gruppo non compariva
This commit is contained in:
Paolo Arena
2022-03-30 22:51:03 +02:00
parent d91aeadb5c
commit 14d45646d2
6 changed files with 40 additions and 18 deletions

View File

@@ -1681,7 +1681,7 @@ UserSchema.statics.ifAlreadyInGroup = async function(idapp, usernameOrig, groupn
}; };
UserSchema.statics.setGroupsCmd = async function(idapp, usernameOrig, groupnameDest, cmd, value) { UserSchema.statics.setGroupsCmd = async function(idapp, usernameOrig, groupnameDest, cmd, value, username_action) {
let ris = null; let ris = null;
let update = {}; let update = {};
@@ -1709,7 +1709,7 @@ UserSchema.statics.setGroupsCmd = async function(idapp, usernameOrig, groupnameD
} }
if (ris) { if (ris) {
// Invia una notifica alla persona e agli Admin // Invia una notifica alla persona e agli Admin
tools.sendNotificationByGroupname(idapp, usernameOrig, groupnameDest, cmd, true); tools.sendNotificationByGroupname(idapp, usernameOrig, groupnameDest, cmd, true, username_action);
ris = await MyGroup.getInfoGroupByGroupname(idapp, groupnameDest); ris = await MyGroup.getInfoGroupByGroupname(idapp, groupnameDest);
} }
} else if (cmd === shared_consts.GROUPSCMD.REQGROUP) { } else if (cmd === shared_consts.GROUPSCMD.REQGROUP) {
@@ -1737,7 +1737,7 @@ UserSchema.statics.setGroupsCmd = async function(idapp, usernameOrig, groupnameD
} }
if (ris) { if (ris) {
// Invia una notifica alla persona // Invia una notifica alla persona
tools.sendNotificationByGroupname(idapp, usernameOrig, groupnameDest, cmd, true); tools.sendNotificationByGroupname(idapp, usernameOrig, groupnameDest, cmd, true, username_action);
} }
} else { } else {
if (foundIfAlreadyAskGroup) { if (foundIfAlreadyAskGroup) {
@@ -1772,7 +1772,7 @@ UserSchema.statics.setGroupsCmd = async function(idapp, usernameOrig, groupnameD
}, },
}); });
//++Todo: Send Notification to Admin and Group's manager //++Todo: Send Notification to Admin and Group's manager
tools.sendNotificationByGroupname(idapp, usernameOrig, groupnameDest, cmd, true); tools.sendNotificationByGroupname(idapp, usernameOrig, groupnameDest, cmd, true, username_action);
} }
} catch (e) { } catch (e) {

View File

@@ -60,5 +60,7 @@ module.exports = {
{_id: 58, idSectorGood: [17], descr: 'Cucito'}, {_id: 58, idSectorGood: [17], descr: 'Cucito'},
{_id: 59, idSectorGood: [17], descr: 'Pulizia'}, {_id: 59, idSectorGood: [17], descr: 'Pulizia'},
{_id: 60, idSectorGood: [17], descr: 'Per Imbiancare'}, {_id: 60, idSectorGood: [17], descr: 'Per Imbiancare'},
{_id: 61, idSectorGood: [17], descr: 'Giardinaggio'},
{_id: 62, idSectorGood: [17], descr: 'Falegnameria'},
], ],
}; };

View File

@@ -223,6 +223,7 @@ router.post('/settable', authenticate, async (req, res) => {
const fieldsvalue = {'ALL': 1}; const fieldsvalue = {'ALL': 1};
mydata.idapp = req.user.idapp; mydata.idapp = req.user.idapp;
const idapp = mydata.idapp;
let consentito = false; let consentito = false;
@@ -1385,6 +1386,11 @@ function uploadFile(req, res, version) {
oldpath = file.path; oldpath = file.path;
file.path = newname; file.path = newname;
if (!tools.sulServer()) {
res.end();
return;
}
// Move in the folder application ! // Move in the folder application !
tools.move(oldpath, newname, (err) => { tools.move(oldpath, newname, (err) => {
if (err) { if (err) {

View File

@@ -16,13 +16,25 @@ const _ = require('lodash');
const {ObjectID} = require('mongodb'); const {ObjectID} = require('mongodb');
async function getGroupRecAdminsInfo(idapp, data) {
for (const admin of data.admins) {
const myuser = await User.findOne({idapp, username: admin.username}).lean();
admin.profile = { img: myuser.profile.img };
}
return data;
}
router.post('/load', authenticate, async (req, res) => { router.post('/load', authenticate, async (req, res) => {
const idapp = req.body.idapp; const idapp = req.body.idapp;
const groupname = req.body.groupname; const groupname = req.body.groupname;
try { try {
const whatshow = MyGroup.getWhatToShow(idapp, req.user.username); const whatshow = MyGroup.getWhatToShow(idapp, req.user.username);
const data = await MyGroup.findOne({idapp, groupname}, whatshow).lean(); let data = await MyGroup.findOne({idapp, groupname}, whatshow).lean();
data = await getGroupRecAdminsInfo(idapp, data);
const whatshowUsers = await User.getWhatToShow_IfFriends(idapp, req.user.username); const whatshowUsers = await User.getWhatToShow_IfFriends(idapp, req.user.username);
@@ -31,9 +43,9 @@ router.post('/load', authenticate, async (req, res) => {
idapp, idapp,
'profile.mygroups': { 'profile.mygroups': {
$elemMatch: {groupname: {$eq: groupname}}, $elemMatch: {groupname: {$eq: groupname}},
}
}, },
whatshowUsers },
whatshowUsers,
); );
res.send({mygroup: data, users_in_group}); res.send({mygroup: data, users_in_group});

View File

@@ -3667,6 +3667,8 @@ if (true) {
const rec = myclTelegram.getRecInMem(msg); const rec = myclTelegram.getRecInMem(msg);
const username_action = rec.user ? rec.user.username : '';
data.username = await User.getRealUsernameByUsername(idapp, data.username); data.username = await User.getRealUsernameByUsername(idapp, data.username);
data.userDest = await User.getRealUsernameByUsername(idapp, data.userDest); data.userDest = await User.getRealUsernameByUsername(idapp, data.userDest);
@@ -3748,7 +3750,7 @@ if (true) {
if (!foundIfAlreadyGroup) { if (!foundIfAlreadyGroup) {
// Aggiungilo nel Gruppo // Aggiungilo nel Gruppo
await User.setGroupsCmd(user.idapp, data.username, group.groupname, cmd); await User.setGroupsCmd(user.idapp, data.username, group.groupname, cmd, 0, username_action);
} }
} }
@@ -3760,7 +3762,7 @@ if (true) {
if (foundIfAlreadyGroup) { if (foundIfAlreadyGroup) {
// Rimuovilo nel Gruppo // Rimuovilo nel Gruppo
await User.setGroupsCmd(user.idapp, data.username, group.groupname, cmd); await User.setGroupsCmd(user.idapp, data.username, group.groupname, cmd, 0, username_action);
} }
} }

View File

@@ -123,8 +123,8 @@ const textlang = {
'MSG_SEND_FROM': 'Msg Inviato da', 'MSG_SEND_FROM': 'Msg Inviato da',
'ZOOM_CONFERMATO': 'Sei stato confermato ad aver visto la Video Conferenza di Benvenuto!', 'ZOOM_CONFERMATO': 'Sei stato confermato ad aver visto la Video Conferenza di Benvenuto!',
'RICHIESTA_AMICIZIA': '🌈 Richiesta d\'Amicizia da parte di %s', 'RICHIESTA_AMICIZIA': '🌈 Richiesta d\'Amicizia da parte di %s',
'ACCETTATO_SUL_GRUPPO': 'Sei stato accettato da %s a far parte del Gruppo %s', 'ACCETTATO_SUL_GRUPPO': 'Sei stato accettato da %s a far parte del Gruppo %s',
'ACCETTATO_NOTIFICA_ADMINS': 'l\'utente %s è stato accettato a far parte del Gruppo %s', 'ACCETTATO_NOTIFICA_ADMINS': 'l\'utente %s è stato accettato a far parte del Gruppo %s (da parte di %s)',
'RICHIESTA_GRUPPO': 'Richiesta di entrare nel Gruppo %s da parte di %s', 'RICHIESTA_GRUPPO': 'Richiesta di entrare nel Gruppo %s da parte di %s',
'RICHIESTA_BLOCCO_GRUPPO': 'Richiesta di bloccare il Gruppo %s da parte di %s', 'RICHIESTA_BLOCCO_GRUPPO': 'Richiesta di bloccare il Gruppo %s da parte di %s',
}, },
@@ -194,7 +194,7 @@ const textlang = {
'ZOOM_CONFERMATO': '¡Se ha confirmado que ha visto la Video Conferencia de Bienvenida!', 'ZOOM_CONFERMATO': '¡Se ha confirmado que ha visto la Video Conferencia de Bienvenida!',
'RICHIESTA_AMICIZIA': 'Richiesta d\'Amicizia da parte di %s', 'RICHIESTA_AMICIZIA': 'Richiesta d\'Amicizia da parte di %s',
'ACCETTATO_SUL_GRUPPO': 'Sei stato accettato da %s a far parte del Gruppo %s', 'ACCETTATO_SUL_GRUPPO': 'Sei stato accettato da %s a far parte del Gruppo %s',
'ACCETTATO_NOTIFICA_ADMINS': 'l\'utente %s è stato accettato a far parte del Gruppo %s', 'ACCETTATO_NOTIFICA_ADMINS': 'l\'utente %s è stato accettato a far parte del Gruppo %s (da parte di %s)',
'RICHIESTA_GRUPPO': 'Richiesta di entrare nel Gruppo %s da parte di %s', 'RICHIESTA_GRUPPO': 'Richiesta di entrare nel Gruppo %s da parte di %s',
'RICHIESTA_BLOCCO_GRUPPO': 'Richiesta di bloccare il Gruppo %s da parte di %s', 'RICHIESTA_BLOCCO_GRUPPO': 'Richiesta di bloccare il Gruppo %s da parte di %s',
}, },
@@ -258,7 +258,7 @@ const textlang = {
'ZOOM_CONFERMATO': 'You have been confirmed to have seen the Welcome Video Conference!', 'ZOOM_CONFERMATO': 'You have been confirmed to have seen the Welcome Video Conference!',
'RICHIESTA_AMICIZIA': 'Richiesta d\'Amicizia da parte di %s', 'RICHIESTA_AMICIZIA': 'Richiesta d\'Amicizia da parte di %s',
'ACCETTATO_SUL_GRUPPO': 'Sei stato accettato da %s a far parte del Gruppo %s', 'ACCETTATO_SUL_GRUPPO': 'Sei stato accettato da %s a far parte del Gruppo %s',
'ACCETTATO_NOTIFICA_ADMINS': 'l\'utente %s è stato accettato a far parte del Gruppo %s', 'ACCETTATO_NOTIFICA_ADMINS': 'l\'utente %s è stato accettato a far parte del Gruppo %s (da parte di %s)',
'RICHIESTA_GRUPPO': 'Richiesta di entrare nel Gruppo %s da parte di %s', 'RICHIESTA_GRUPPO': 'Richiesta di entrare nel Gruppo %s da parte di %s',
'RICHIESTA_BLOCCO_GRUPPO': 'Richiesta di bloccare il Gruppo %s da parte di %s', 'RICHIESTA_BLOCCO_GRUPPO': 'Richiesta di bloccare il Gruppo %s da parte di %s',
}, },
@@ -327,7 +327,7 @@ const textlang = {
'ZOOM_CONFERMATO': 'Vous avez été confirmé comme ayant vu la vidéoconférence de bienvenue !', 'ZOOM_CONFERMATO': 'Vous avez été confirmé comme ayant vu la vidéoconférence de bienvenue !',
'RICHIESTA_AMICIZIA': 'Richiesta d\'Amicizia da parte di %s', 'RICHIESTA_AMICIZIA': 'Richiesta d\'Amicizia da parte di %s',
'ACCETTATO_SUL_GRUPPO': 'Sei stato accettato da %s a far parte del Gruppo %s', 'ACCETTATO_SUL_GRUPPO': 'Sei stato accettato da %s a far parte del Gruppo %s',
'ACCETTATO_NOTIFICA_ADMINS': 'l\'utente %s è stato accettato a far parte del Gruppo %s', 'ACCETTATO_NOTIFICA_ADMINS': 'l\'utente %s è stato accettato a far parte del Gruppo %s (da parte di %s)',
'RICHIESTA_GRUPPO': 'Richiesta di entrare nel Gruppo %s da parte di %s', 'RICHIESTA_GRUPPO': 'Richiesta di entrare nel Gruppo %s da parte di %s',
'RICHIESTA_BLOCCO_GRUPPO': 'Richiesta di bloccare il Gruppo %s da parte di %s', 'RICHIESTA_BLOCCO_GRUPPO': 'Richiesta di bloccare il Gruppo %s da parte di %s',
}, },
@@ -394,7 +394,7 @@ const textlang = {
'ZOOM_CONFERMATO': 'Foi-lhe confirmado que assistiu à Conferência de Vídeo de Boas-vindas!', 'ZOOM_CONFERMATO': 'Foi-lhe confirmado que assistiu à Conferência de Vídeo de Boas-vindas!',
'RICHIESTA_AMICIZIA': 'Richiesta d\'Amicizia da parte di %s', 'RICHIESTA_AMICIZIA': 'Richiesta d\'Amicizia da parte di %s',
'ACCETTATO_SUL_GRUPPO': 'Sei stato accettato da %s a far parte del Gruppo %s', 'ACCETTATO_SUL_GRUPPO': 'Sei stato accettato da %s a far parte del Gruppo %s',
'ACCETTATO_NOTIFICA_ADMINS': 'l\'utente %s è stato accettato a far parte del Gruppo %s', 'ACCETTATO_NOTIFICA_ADMINS': 'l\'utente %s è stato accettato a far parte del Gruppo %s (da parte di %s)',
'RICHIESTA_GRUPPO': 'Richiesta di entrare nel Gruppo %s da parte di %s', 'RICHIESTA_GRUPPO': 'Richiesta di entrare nel Gruppo %s da parte di %s',
'RICHIESTA_BLOCCO_GRUPPO': 'Richiesta di bloccare il Gruppo %s da parte di %s', 'RICHIESTA_BLOCCO_GRUPPO': 'Richiesta di bloccare il Gruppo %s da parte di %s',
}, },
@@ -897,7 +897,7 @@ module.exports = {
} }
}, },
sendNotificationByGroupname: async function(idapp, usernameOrig, groupname, cmd, telegram) { sendNotificationByGroupname: async function(idapp, usernameOrig, groupname, cmd, telegram, username_action) {
var {User} = require('../models/user'); var {User} = require('../models/user');
var {MyGroup} = require('../models/mygroup'); var {MyGroup} = require('../models/mygroup');
@@ -939,7 +939,7 @@ module.exports = {
if (cmd) { if (cmd) {
if (cmd === shared_consts.GROUPSCMD.SETGROUP) { if (cmd === shared_consts.GROUPSCMD.SETGROUP) {
objmsg.descr = printf(this.get__('ACCETTATO_NOTIFICA_ADMINS', lang), singleadmin.username, groupname); objmsg.descr = printf(this.get__('ACCETTATO_NOTIFICA_ADMINS', lang), usernameOrig, groupname, username_action);
objmsg.openUrl = '/grp/' + groupname; objmsg.openUrl = '/grp/' + groupname;
objmsg.tag = 'addgroups'; objmsg.tag = 'addgroups';
@@ -974,7 +974,7 @@ module.exports = {
if (cmd === shared_consts.GROUPSCMD.SETGROUP) { if (cmd === shared_consts.GROUPSCMD.SETGROUP) {
const reclang = await User.getRecLangAndIdByUsername(idapp, usernameOrig); const reclang = await User.getRecLangAndIdByUsername(idapp, usernameOrig);
objmsg.descr = printf(this.get__('ACCETTATO_SUL_GRUPPO', reclang.lang), usernameOrig, groupname); objmsg.descr = printf(this.get__('ACCETTATO_SUL_GRUPPO', reclang.lang), username_action, groupname);
objmsg.openUrl = '/grp/' + groupname; objmsg.openUrl = '/grp/' + groupname;
objmsg.tag = 'addgroups'; objmsg.tag = 'addgroups';