++Strette di Mano
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
"<strong>%s</strong> accepted your HandShake": "<strong>%s</strong> ha accettato la Stretta di mano",
|
"<strong>%s</strong> accepted your HandShake": "<strong>%s</strong> ha accettato la Stretta di mano",
|
||||||
"<strong>%s</strong> refused your HandShake": "<strong>%s</strong> ha rifiutato la Stretta di mano",
|
"<strong>%s</strong> refused your HandShake": "<strong>%s</strong> ha rifiutato la Stretta di mano",
|
||||||
"✅ %s accepted your HandShake request !": "✅ %s ha accettato la tua richiesta di Stretta di mano !",
|
"✅ %s accepted your HandShake request !": "✅ %s ha accettato la tua richiesta di Stretta di mano !",
|
||||||
"✅ You have accepted %s' HandShake request!": "✅ Hai accettato la richiesta di Stretta di mano di %s !",
|
"✅ You have accepted %s HandShake request!": "✅ Hai accettato la richiesta di Stretta di mano di %s !",
|
||||||
"GROUPS_ACCEPTED": "✅ Sei stato accettato da %s a far parte del Gruppo %s (da parte di %s)",
|
"GROUPS_ACCEPTED": "✅ Sei stato accettato da %s a far parte del Gruppo %s (da parte di %s)",
|
||||||
"GROUPS_REFUSED": "❌ Ti è stato rifiutato l'accesso da %s a far parte del Gruppo %s. Se pensi sia un'errore, contatta l'amministratore del Gruppo.",
|
"GROUPS_REFUSED": "❌ Ti è stato rifiutato l'accesso da %s a far parte del Gruppo %s. Se pensi sia un'errore, contatta l'amministratore del Gruppo.",
|
||||||
"GROUPS_REMOVED": "❌ l'utente %s è stato rimosso del Gruppo %s (da parte di %s)",
|
"GROUPS_REMOVED": "❌ l'utente %s è stato rimosso del Gruppo %s (da parte di %s)",
|
||||||
@@ -73,4 +73,4 @@
|
|||||||
"STATUS_SENT": "Inviato",
|
"STATUS_SENT": "Inviato",
|
||||||
"STATUS_REFUSED": "Rifiutato",
|
"STATUS_REFUSED": "Rifiutato",
|
||||||
"CLICCA_QUI": "CLICCA QUI"
|
"CLICCA_QUI": "CLICCA QUI"
|
||||||
}
|
}
|
||||||
@@ -214,17 +214,17 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif) {
|
|||||||
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_HANDSHAKE) {
|
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_HANDSHAKE) {
|
||||||
recnotif.openUrl = '/my/' + userorig;
|
recnotif.openUrl = '/my/' + userorig;
|
||||||
if (recnotif.typeid === shared_consts.TypeNotifs.ID_HANDSHAKE_NEW_REC) {
|
if (recnotif.typeid === shared_consts.TypeNotifs.ID_HANDSHAKE_NEW_REC) {
|
||||||
newdescr = i18n.__('<strong>%s</strong> asked you for HandShake', userorig, mydescr);
|
newdescr = i18n.__('<strong>%s</strong> asked you HandShake', userorig, mydescr);
|
||||||
tag = 'newfriend';
|
tag = 'newhandshake';
|
||||||
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_HANDSHAKE_ACCEPTED) {
|
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_HANDSHAKE_ACCEPTED) {
|
||||||
newdescr = i18n.__('<strong>%s</strong> accepted your HandShake', userorig, mydescr);
|
newdescr = i18n.__('<strong>%s</strong> accepted your HandShake', userorig, mydescr);
|
||||||
tag = 'acceptedfriend';
|
tag = 'acceptedhandshake';
|
||||||
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_HANDSHAKE_ACCEPTED_MY_REQUEST) {
|
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_HANDSHAKE_ACCEPTED_MY_REQUEST) {
|
||||||
newdescr = i18n.__('✅ You have accepted %s\' HandShake request!', userorig, mydescr);
|
newdescr = i18n.__('✅ You have accepted %s HandShake request!', userorig, mydescr);
|
||||||
tag = 'acceptedfriend';
|
tag = 'acceptedhandshake';
|
||||||
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_HANDSHAKE_REFUSED) {
|
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_HANDSHAKE_REFUSED) {
|
||||||
newdescr = i18n.__('<strong>%s</strong> refused your HandShake', userorig, mydescr);
|
newdescr = i18n.__('<strong>%s</strong> refused your HandShake', userorig, mydescr);
|
||||||
tag = 'refusedfriend';
|
tag = 'refusedhandshake';
|
||||||
}
|
}
|
||||||
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_GROUPS) {
|
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_GROUPS) {
|
||||||
tag = 'group';
|
tag = 'group';
|
||||||
|
|||||||
@@ -1496,6 +1496,17 @@ UserSchema.statics.isMyFriend = async function (idapp, username, myusername) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
UserSchema.statics.isMyHandShake = async function (idapp, username, myusername) {
|
||||||
|
|
||||||
|
const myhandshake = await User.getUsernameHandShakeByUsername(idapp, myusername);
|
||||||
|
if (myhandshake) {
|
||||||
|
return await myhandshake.includes(username);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
UserSchema.statics.getUserProfileByUsername = async function (
|
UserSchema.statics.getUserProfileByUsername = async function (
|
||||||
idapp, username, myusername, usaSuperPower, myperm = '') {
|
idapp, username, myusername, usaSuperPower, myperm = '') {
|
||||||
const User = this;
|
const User = this;
|
||||||
@@ -1554,6 +1565,7 @@ UserSchema.statics.getUserProfileByUsername = async function (
|
|||||||
'profile.born_province': 1,
|
'profile.born_province': 1,
|
||||||
'profile.born_country': 1,
|
'profile.born_country': 1,
|
||||||
'profile.calc': 1,
|
'profile.calc': 1,
|
||||||
|
'profile.req_handshake': 1,
|
||||||
'profile.handshake': 1,
|
'profile.handshake': 1,
|
||||||
'profile.friends': 1,
|
'profile.friends': 1,
|
||||||
email: 1,
|
email: 1,
|
||||||
@@ -1598,6 +1610,7 @@ UserSchema.statics.getUserProfileByUsername = async function (
|
|||||||
'profile.born_country': 1,
|
'profile.born_country': 1,
|
||||||
'profile.calc': 1,
|
'profile.calc': 1,
|
||||||
'profile.handshake': 1,
|
'profile.handshake': 1,
|
||||||
|
'profile.req_handshake': 1,
|
||||||
'profile.friends': 1,
|
'profile.friends': 1,
|
||||||
email: 1,
|
email: 1,
|
||||||
date_reg: 1,
|
date_reg: 1,
|
||||||
@@ -1642,6 +1655,7 @@ UserSchema.statics.getUserProfileByUsername = async function (
|
|||||||
'profile.born_country': 1,
|
'profile.born_country': 1,
|
||||||
'profile.calc': 1,
|
'profile.calc': 1,
|
||||||
'profile.handshake': 1,
|
'profile.handshake': 1,
|
||||||
|
'profile.req_handshake': 1,
|
||||||
'profile.friends': 1,
|
'profile.friends': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'comune': 1,
|
'comune': 1,
|
||||||
@@ -1911,12 +1925,12 @@ UserSchema.statics.setFriendsCmd = async function (req, idapp, usernameOrig, use
|
|||||||
// Send a notification to the DESTINATION FRIENDSHIP !
|
// Send a notification to the DESTINATION FRIENDSHIP !
|
||||||
let req = tools.getReqByPar(idapp, usernameOrig);
|
let req = tools.getReqByPar(idapp, usernameOrig);
|
||||||
await SendNotif.createNewNotifToSingleUser(req, null, { usernameDest }, true, shared_consts.TypeNotifs.TYPEDIR_FRIENDS,
|
await SendNotif.createNewNotifToSingleUser(req, null, { usernameDest }, true, shared_consts.TypeNotifs.TYPEDIR_FRIENDS,
|
||||||
shared_consts.TypeNotifs.ID_FRIENDS_ACCEPTED);
|
shared_consts.TypeNotifs.ID_FRIENDS_ACCEPTED_MY_REQUEST);
|
||||||
|
|
||||||
// Send a notification to the SENDER FRIENDSHIP !
|
// Send a notification to the SENDER FRIENDSHIP !
|
||||||
req = tools.getReqByPar(idapp, usernameDest);
|
req = tools.getReqByPar(idapp, usernameDest);
|
||||||
await SendNotif.createNewNotifToSingleUser(req, null, { usernameDest: usernameOrig }, true, shared_consts.TypeNotifs.TYPEDIR_FRIENDS,
|
await SendNotif.createNewNotifToSingleUser(req, null, { usernameDest: usernameOrig }, true, shared_consts.TypeNotifs.TYPEDIR_FRIENDS,
|
||||||
shared_consts.TypeNotifs.ID_FRIENDS_ACCEPTED_MY_REQUEST);
|
shared_consts.TypeNotifs.ID_FRIENDS_ACCEPTED);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1928,11 +1942,11 @@ UserSchema.statics.setFriendsCmd = async function (req, idapp, usernameOrig, use
|
|||||||
if (!disablenotif) {
|
if (!disablenotif) {
|
||||||
const userDest = await User.getRecLangAndIdByUsername(idapp, usernameDest);
|
const userDest = await User.getRecLangAndIdByUsername(idapp, usernameDest);
|
||||||
const user = await User.getRecLangAndIdByUsername(idapp, usernameOrig);
|
const user = await User.getRecLangAndIdByUsername(idapp, usernameOrig);
|
||||||
const msgDest = i18n.__({ phrase: '✅ %s accepted your Friendship request !', locale: user.lang }, usernameOrig);
|
const msgDest = i18n.__({ phrase: '✅ %s accepted your Friendship request !', locale: userDest.lang }, usernameDest);
|
||||||
const msgOrig = i18n.__({ phrase: '✅ You have accepted %s\' Friendship request!', locale: userDest.lang }, usernameDest);
|
const msgOrig = i18n.__({ phrase: '✅ You have accepted %s\' Friendship request!', locale: user.lang }, usernameOrig);
|
||||||
|
|
||||||
await telegrambot.sendMsgTelegram(idapp, usernameDest, msgDest);
|
await telegrambot.sendMsgTelegram(idapp, usernameOrig, msgDest);
|
||||||
await telegrambot.sendMsgTelegram(idapp, usernameOrig, msgOrig);
|
await telegrambot.sendMsgTelegram(idapp, usernameDest, msgOrig);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Notification : ', e);
|
console.error('Notification : ', e);
|
||||||
@@ -1989,15 +2003,15 @@ UserSchema.statics.setFriendsCmd = async function (req, idapp, usernameOrig, use
|
|||||||
ris = await User.updateOne({ idapp, username: usernameOrig }, update);
|
ris = await User.updateOne({ idapp, username: usernameOrig }, update);
|
||||||
|
|
||||||
if (!disablenotif) {
|
if (!disablenotif) {
|
||||||
// Send a notification to the DESTINATION FRIENDSHIP !
|
// Send a notification to the DESTINATION HANDSHAKE !
|
||||||
let req = tools.getReqByPar(idapp, usernameOrig);
|
let req = tools.getReqByPar(idapp, usernameOrig);
|
||||||
await SendNotif.createNewNotifToSingleUser(req, null, { usernameDest }, true, shared_consts.TypeNotifs.TYPEDIR_HANDSHAKE,
|
await SendNotif.createNewNotifToSingleUser(req, null, { usernameDest }, true, shared_consts.TypeNotifs.TYPEDIR_HANDSHAKE,
|
||||||
shared_consts.TypeNotifs.ID_HANDSHAKE_ACCEPTED);
|
shared_consts.TypeNotifs.ID_HANDSHAKE_ACCEPTED_MY_REQUEST);
|
||||||
|
|
||||||
// Send a notification to the SENDER HANDSHAKEHIP !
|
// Send a notification to the SENDER HANDSHAKEHIP !
|
||||||
req = tools.getReqByPar(idapp, usernameDest);
|
req = tools.getReqByPar(idapp, usernameDest);
|
||||||
await SendNotif.createNewNotifToSingleUser(req, null, { usernameDest: usernameOrig }, true, shared_consts.TypeNotifs.TYPEDIR_HANDSHAKE,
|
await SendNotif.createNewNotifToSingleUser(req, null, { usernameDest: usernameOrig }, true, shared_consts.TypeNotifs.TYPEDIR_HANDSHAKE,
|
||||||
shared_consts.TypeNotifs.ID_HANDSHAKE_ACCEPTED_MY_REQUEST);
|
shared_consts.TypeNotifs.ID_HANDSHAKE_ACCEPTED);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2009,11 +2023,11 @@ UserSchema.statics.setFriendsCmd = async function (req, idapp, usernameOrig, use
|
|||||||
if (!disablenotif) {
|
if (!disablenotif) {
|
||||||
const userDest = await User.getRecLangAndIdByUsername(idapp, usernameDest);
|
const userDest = await User.getRecLangAndIdByUsername(idapp, usernameDest);
|
||||||
const user = await User.getRecLangAndIdByUsername(idapp, usernameOrig);
|
const user = await User.getRecLangAndIdByUsername(idapp, usernameOrig);
|
||||||
const msgDest = i18n.__({ phrase: '✅ %s accepted your HandShake request !', locale: user.lang }, usernameOrig);
|
const msgDest = i18n.__({ phrase: '✅ %s accepted your HandShake request !', locale: userDest.lang }, usernameDest);
|
||||||
const msgOrig = i18n.__({ phrase: '✅ You have accepted %s\' HandShake request!', locale: userDest.lang }, usernameDest);
|
const msgOrig = i18n.__({ phrase: '✅ You have accepted %s HandShake request!', locale: user.lang }, usernameOrig);
|
||||||
|
|
||||||
await telegrambot.sendMsgTelegram(idapp, usernameDest, msgDest);
|
await telegrambot.sendMsgTelegram(idapp, usernameOrig, msgDest);
|
||||||
await telegrambot.sendMsgTelegram(idapp, usernameOrig, msgOrig);
|
await telegrambot.sendMsgTelegram(idapp, usernameDest, msgOrig);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Notification : ', e);
|
console.error('Notification : ', e);
|
||||||
@@ -2778,6 +2792,7 @@ function getWhatToShow(idapp, username) {
|
|||||||
date_reg: 1,
|
date_reg: 1,
|
||||||
'profile.friends': 1,
|
'profile.friends': 1,
|
||||||
'profile.handshake': 1,
|
'profile.handshake': 1,
|
||||||
|
'profile.req_handshake': 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2896,6 +2911,8 @@ UserSchema.statics.getFriendsByUsername = async function (idapp, username) {
|
|||||||
listRequestFriends: [],
|
listRequestFriends: [],
|
||||||
listTrusted: [],
|
listTrusted: [],
|
||||||
listSentRequestFriends: [],
|
listSentRequestFriends: [],
|
||||||
|
listSentRequestHandShake: [],
|
||||||
|
listRequestHandShake: [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4494,12 +4511,12 @@ UserSchema.statics.DbOp = async function (idapp, mydata) {
|
|||||||
UserSchema.statics.getExtraInfoByUsername = async function (idapp, username) {
|
UserSchema.statics.getExtraInfoByUsername = async function (idapp, username) {
|
||||||
const User = this;
|
const User = this;
|
||||||
|
|
||||||
let myuser = await User.findOne({ idapp, username });
|
let myuser = await User.findOne({ idapp, username }).lean();
|
||||||
if (myuser) {
|
if (myuser) {
|
||||||
myuserextra = await User.addExtraInfo(idapp, myuser);
|
myuserextra = await User.addExtraInfo(idapp, myuser);
|
||||||
}
|
}
|
||||||
|
|
||||||
return myuser._doc.profile;
|
return myuser.profile;
|
||||||
|
|
||||||
};
|
};
|
||||||
UserSchema.statics.addExtraInfo = async function (idapp, recUser) {
|
UserSchema.statics.addExtraInfo = async function (idapp, recUser) {
|
||||||
@@ -4507,8 +4524,8 @@ UserSchema.statics.addExtraInfo = async function (idapp, recUser) {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (recUser._doc.profile && recUser._doc.profile.notifs && recUser._doc.profile.notifs.length <= 0) {
|
if (recUser.profile && recUser.profile.notifs && recUser.profile.notifs.length <= 0) {
|
||||||
recUser._doc.profile.notifs = shared_consts.DEFAULT_NOTIFS_USER;
|
recUser.profile.notifs = shared_consts.DEFAULT_NOTIFS_USER;
|
||||||
await recUser.save();
|
await recUser.save();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -4525,7 +4542,7 @@ UserSchema.statics.addExtraInfo = async function (idapp, recUser) {
|
|||||||
{ deleted: { $exists: true, $eq: false } }],
|
{ deleted: { $exists: true, $eq: false } }],
|
||||||
}, { username: 1 }).lean();
|
}, { username: 1 }).lean();
|
||||||
|
|
||||||
recUser._doc.profile.asked_friends = listSentMyRequestFriends
|
recUser.profile.asked_friends = listSentMyRequestFriends
|
||||||
? listSentMyRequestFriends
|
? listSentMyRequestFriends
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
@@ -4539,7 +4556,7 @@ UserSchema.statics.addExtraInfo = async function (idapp, recUser) {
|
|||||||
{ deleted: { $exists: true, $eq: false } }],
|
{ deleted: { $exists: true, $eq: false } }],
|
||||||
}, { username: 1 }).lean();
|
}, { username: 1 }).lean();
|
||||||
|
|
||||||
recUser._doc.profile.asked_handshake = listSentMyRequestHandShake
|
recUser.profile.asked_handshake = listSentMyRequestHandShake
|
||||||
? listSentMyRequestHandShake
|
? listSentMyRequestHandShake
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
@@ -4553,7 +4570,7 @@ UserSchema.statics.addExtraInfo = async function (idapp, recUser) {
|
|||||||
{ deleted: { $exists: true, $eq: false } }],
|
{ deleted: { $exists: true, $eq: false } }],
|
||||||
}, MyGroup.getWhatToShow_Unknown()).lean();
|
}, MyGroup.getWhatToShow_Unknown()).lean();
|
||||||
|
|
||||||
recUser._doc.profile.asked_groups = listSentMyRequestGroups
|
recUser.profile.asked_groups = listSentMyRequestGroups
|
||||||
? listSentMyRequestGroups
|
? listSentMyRequestGroups
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
@@ -4567,7 +4584,7 @@ UserSchema.statics.addExtraInfo = async function (idapp, recUser) {
|
|||||||
{ deleted: { $exists: true, $eq: false } }],
|
{ deleted: { $exists: true, $eq: false } }],
|
||||||
}, MyGroup.getWhatToShow_Unknown()).lean();
|
}, MyGroup.getWhatToShow_Unknown()).lean();
|
||||||
|
|
||||||
recUser._doc.profile.refused_groups = listRefusedGroups
|
recUser.profile.refused_groups = listRefusedGroups
|
||||||
? listRefusedGroups
|
? listRefusedGroups
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
@@ -4581,7 +4598,7 @@ UserSchema.statics.addExtraInfo = async function (idapp, recUser) {
|
|||||||
{ deleted: { $exists: true, $eq: false } }],
|
{ deleted: { $exists: true, $eq: false } }],
|
||||||
}).lean();
|
}).lean();
|
||||||
|
|
||||||
recUser._doc.profile.manage_mygroups = listManageGroups
|
recUser.profile.manage_mygroups = listManageGroups
|
||||||
? listManageGroups
|
? listManageGroups
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
@@ -4591,14 +4608,14 @@ UserSchema.statics.addExtraInfo = async function (idapp, recUser) {
|
|||||||
|
|
||||||
const useraccounts = await Account.getUserAccounts(idapp, recUser.username);
|
const useraccounts = await Account.getUserAccounts(idapp, recUser.username);
|
||||||
|
|
||||||
recUser._doc.profile = { ...recUser._doc.profile, ...circuitobj, useraccounts };
|
recUser.profile = { ...recUser.profile, ...circuitobj, useraccounts };
|
||||||
|
|
||||||
recUser._doc.calcstat = await User.calculateStat(idapp, recUser.username);
|
recUser.calcstat = await User.calculateStat(idapp, recUser.username);
|
||||||
|
|
||||||
recUser._doc.profile.calc = await User.calcOtherByUser(idapp, recUser._id);
|
recUser.profile.calc = await User.calcOtherByUser(idapp, recUser._id);
|
||||||
|
|
||||||
|
|
||||||
return recUser._doc;
|
return recUser;
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Err addExtraInfo', e);
|
console.error('Err addExtraInfo', e);
|
||||||
|
|||||||
@@ -1347,7 +1347,7 @@ function load(req, res, version) {
|
|||||||
let myuserextra = null;
|
let myuserextra = null;
|
||||||
if (req.user) {
|
if (req.user) {
|
||||||
// askedfriends = User.getAskedFriendsByUsername(idapp, req.user.username);
|
// askedfriends = User.getAskedFriendsByUsername(idapp, req.user.username);
|
||||||
myuserextra = User.addExtraInfo(idapp, req.user);
|
myuserextra = User.addExtraInfo(idapp, req.user._doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
|
|||||||
@@ -684,7 +684,12 @@ router.post('/friends/cmd', authenticate, async (req, res) => {
|
|||||||
|
|
||||||
if (!User.isAdmin(req.user.perm) || !User.isManager(req.user.perm)) {
|
if (!User.isAdmin(req.user.perm) || !User.isManager(req.user.perm)) {
|
||||||
// If without permissions, exit
|
// If without permissions, exit
|
||||||
if (usernameOrig !== usernameLogged) {
|
if ((usernameOrig !== usernameLogged) && (
|
||||||
|
(usernameDest !== usernameLogged) &&
|
||||||
|
((cmd === shared_consts.FRIENDSCMD.SETFRIEND) ||
|
||||||
|
(cmd === shared_consts.FRIENDSCMD.SETHANDSHAKE))
|
||||||
|
|
||||||
|
)) {
|
||||||
return res.status(404).
|
return res.status(404).
|
||||||
send({ code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: '' });
|
send({ code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: '' });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -498,6 +498,7 @@ const txt = {
|
|||||||
MSG_APORTADOR_ASK_CONFIRM: '🆕💥 🧍♂️ Abilita Nuova Registrazione:',
|
MSG_APORTADOR_ASK_CONFIRM: '🆕💥 🧍♂️ Abilita Nuova Registrazione:',
|
||||||
MSG_ACCEPT_NEWENTRY_INGROUP: '❇️👥 🧍♂️ Accetta Ingresso nel GRUPPO %s:',
|
MSG_ACCEPT_NEWENTRY_INGROUP: '❇️👥 🧍♂️ Accetta Ingresso nel GRUPPO %s:',
|
||||||
MSG_FRIENDS_NOT_ACCEPTED_CONFIRMED: '🚫 Hai rifiutato la richiesta di Amicizia di %s !',
|
MSG_FRIENDS_NOT_ACCEPTED_CONFIRMED: '🚫 Hai rifiutato la richiesta di Amicizia di %s !',
|
||||||
|
MSG_HANDSHAKE_NOT_ACCEPTED_CONFIRMED: '🚫 Hai rifiutato la richiesta di Stretta di mano di %s !',
|
||||||
MSG_APORTADOR_CONFIRMED: '✅ %s è stato Abilitato correttamente (da %s)!',
|
MSG_APORTADOR_CONFIRMED: '✅ %s è stato Abilitato correttamente (da %s)!',
|
||||||
MSG_APORTADOR_DEST_CONFIRMED: '✅ Sei stato Abilitato correttamente da %s!\n' +
|
MSG_APORTADOR_DEST_CONFIRMED: '✅ Sei stato Abilitato correttamente da %s!\n' +
|
||||||
'Vai sulla App oppure clicca qui per entrare\n👉🏻 %s',
|
'Vai sulla App oppure clicca qui per entrare\n👉🏻 %s',
|
||||||
@@ -4111,6 +4112,33 @@ if (true) {
|
|||||||
if (ris) {
|
if (ris) {
|
||||||
const msgDest = printf(getstr(user.lang, 'MSG_FRIENDS_NOT_ACCEPTED_CONFIRMED'), data.username);
|
const msgDest = printf(getstr(user.lang, 'MSG_FRIENDS_NOT_ACCEPTED_CONFIRMED'), data.username);
|
||||||
|
|
||||||
|
await local_sendMsgTelegram(user.idapp, data.userDest, msgDest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (data.action === InlineConferma.RISPOSTA_SI + shared_consts.CallFunz.RICHIESTA_HANDSHAKE) {
|
||||||
|
|
||||||
|
if (userDest) {
|
||||||
|
cmd = shared_consts.FRIENDSCMD.SETHANDSHAKE;
|
||||||
|
const foundIfAlreadyFriend = await User.isMyHandShake(user.idapp, data.username, data.userDest);
|
||||||
|
|
||||||
|
if (!foundIfAlreadyFriend) {
|
||||||
|
// Aggiungilo nelle HandShake
|
||||||
|
const req = tools.getReqByPar(user.idapp, username_action);
|
||||||
|
const ris = await User.setFriendsCmd(req, user.idapp, data.username, data.userDest, cmd);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else if (data.action === InlineConferma.RISPOSTA_NO + shared_consts.CallFunz.RICHIESTA_HANDSHAKE) {
|
||||||
|
|
||||||
|
if (userDest) {
|
||||||
|
cmd = shared_consts.FRIENDSCMD.REMOVE_FROM_MYHANDSHAKE;
|
||||||
|
// Rimuovilo nelle HandShake
|
||||||
|
const req = tools.getReqByPar(user.idapp, username_action);
|
||||||
|
const ris = await User.setFriendsCmd(req, user.idapp, data.username, data.userDest, cmd);
|
||||||
|
if (ris) {
|
||||||
|
const msgDest = printf(getstr(user.lang, 'MSG_HANDSHAKE_NOT_ACCEPTED_CONFIRMED'), data.username);
|
||||||
|
|
||||||
await local_sendMsgTelegram(user.idapp, data.userDest, msgDest);
|
await local_sendMsgTelegram(user.idapp, data.userDest, msgDest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -423,6 +423,12 @@ module.exports = {
|
|||||||
TYPEDIR_MSGS: 7,
|
TYPEDIR_MSGS: 7,
|
||||||
ID_MSGS_NEW_REC: 1,
|
ID_MSGS_NEW_REC: 1,
|
||||||
|
|
||||||
|
TYPEDIR_HANDSHAKE: 10,
|
||||||
|
ID_HANDSHAKE_NEW_REC: 1,
|
||||||
|
ID_HANDSHAKE_ACCEPTED: 2,
|
||||||
|
ID_HANDSHAKE_REFUSED: 4,
|
||||||
|
ID_HANDSHAKE_ACCEPTED_MY_REQUEST: 8,
|
||||||
|
|
||||||
TYPEDIR_TEST: 444,
|
TYPEDIR_TEST: 444,
|
||||||
ID_TEST_NEW_REC: 1,
|
ID_TEST_NEW_REC: 1,
|
||||||
},
|
},
|
||||||
@@ -479,24 +485,24 @@ module.exports = {
|
|||||||
|
|
||||||
DEFAULT_NOTIFS_USER: [
|
DEFAULT_NOTIFS_USER: [
|
||||||
{
|
{
|
||||||
"dir": 1,
|
'dir': 1,
|
||||||
"value": 24
|
'value': 24
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"dir": 2,
|
'dir': 2,
|
||||||
"value": 1
|
'value': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"dir": 3,
|
'dir': 3,
|
||||||
"value": 1
|
'value': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"dir": 4,
|
'dir': 4,
|
||||||
"value": 1
|
'value': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"dir": 5,
|
'dir': 5,
|
||||||
"value": 1
|
'value': 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user