strette di mano

This commit is contained in:
Surya Paolo
2023-01-06 15:51:48 +01:00
parent f42a39d231
commit d183a07bad
7 changed files with 334 additions and 15 deletions

View File

@@ -210,16 +210,21 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif) {
recnotif.openUrl = '/my/' + recnotif.paramsObj.username_action;
newdescr = i18n.__('FRIEND_REPORTED_TO_ME', recnotif.paramsObj.username_action, recnotif.paramsObj.username_action);
}
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_FRIENDS_UNBLOCKED) {
tag = 'unblockeduser';
if (recnotif.paramsObj.usernameDest === recnotif.paramsObj.username_action) {
newdescr = i18n.__('FRIEND_UNBLOCKED_YOU', recnotif.paramsObj.username_worked);
recnotif.openUrl = '/my/' + recnotif.paramsObj.username_worked;
} else if (recnotif.paramsObj.isAdmin) {
newdescr = i18n.__('FRIEND_UNBLOCKED', recnotif.paramsObj.usernameDest, userorig);
} else {
newdescr = i18n.__('FRIEND_UNBLOCKED_TO_ME', recnotif.paramsObj.username_action, recnotif.paramsObj.username_action);
}
}
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_HANDSHAKE) {
recnotif.openUrl = '/my/' + userorig;
if (recnotif.typeid === shared_consts.TypeNotifs.ID_HANDSHAKE_NEW_REC) {
newdescr = i18n.__('<strong>%s</strong> asked you for HandShake', userorig, mydescr);
tag = 'newfriend';
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_HANDSHAKE_ACCEPTED) {
newdescr = i18n.__('<strong>%s</strong> accepted your HandShake', userorig, mydescr);
tag = 'acceptedfriend';
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_HANDSHAKE_ACCEPTED_MY_REQUEST) {
newdescr = i18n.__('✅ You have accepted %s\' HandShake request!', userorig, mydescr);
tag = 'acceptedfriend';
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_HANDSHAKE_REFUSED) {
newdescr = i18n.__('<strong>%s</strong> refused your HandShake', userorig, mydescr);
tag = 'refusedfriend';
}
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_GROUPS) {
tag = 'group';
@@ -450,7 +455,7 @@ sendNotifSchema.statics.saveAndSendNotif = async function (myrecnotif, req, res,
let idapp = req.body.idapp;
let check = tools.checkUserOk(myrecnotif.sender, user ? myrecnotif.sender : req.user.username, res);
if (!check)
if (!check)
check = tools.checkUserOk(myrecnotif.sendergroup, user ? myrecnotif.sendergroup : req.user.username, res);
if (check.exit) return check.ret;
@@ -517,6 +522,19 @@ sendNotifSchema.statics.updateStatusAndDescr = async function (myrecnotif, onlys
newstatus = shared_consts.StatusNotifs.STATUS_FRIENDS_REFUSED;
dest = myrecnotif.sender;
}
} else if (myrecnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_HANDSHAKE) {
typeidsearch = shared_consts.TypeNotifs.ID_HANDSHAKE_NEW_REC;
if (myrecnotif.typeid === shared_consts.TypeNotifs.ID_HANDSHAKE_ACCEPTED) {
newstatus = shared_consts.StatusNotifs.STATUS_HANDSHAKE_ACCEPTED;
dest = myrecnotif.sender;
} else if (myrecnotif.typeid === shared_consts.TypeNotifs.ID_HANDSHAKE_ACCEPTED_MY_REQUEST) {
newstatus = shared_consts.StatusNotifs.STATUS_HANDSHAKE_ACCEPTED;
newdest = myrecnotif.sender;
sender = myrecnotif.dest;
} else if (myrecnotif.typeid === shared_consts.TypeNotifs.ID_HANDSHAKE_REFUSED) {
newstatus = shared_consts.StatusNotifs.STATUS_HANDSHAKE_REFUSED;
dest = myrecnotif.sender;
}
} else if (myrecnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_GROUPS) {
typeidsearch = shared_consts.TypeNotifs.ID_GROUP_NEW_REC;
dest = myrecnotif.dest;