fix strette di mano
This commit is contained in:
@@ -1968,6 +1968,8 @@ UserSchema.statics.setFriendsCmd = async function (req, idapp, usernameOrig, use
|
|||||||
},
|
},
|
||||||
}, { _id: 1 }).lean();
|
}, { _id: 1 }).lean();
|
||||||
|
|
||||||
|
let rec = null;
|
||||||
|
|
||||||
if (!foundIfAlreadyFriend) {
|
if (!foundIfAlreadyFriend) {
|
||||||
update = {
|
update = {
|
||||||
$push: {
|
$push: {
|
||||||
@@ -1977,19 +1979,19 @@ UserSchema.statics.setFriendsCmd = async function (req, idapp, usernameOrig, use
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
ris = await User.updateOne({ idapp, username: usernameDest }, update);
|
rec = await User.updateOne({ idapp, username: usernameDest }, update);
|
||||||
|
|
||||||
if (!disablenotif) {
|
if (!disablenotif) {
|
||||||
// Send a notification to the DESTINATION HANDSHAKE !
|
// Send a notification to the DESTINATION HANDSHAKE !
|
||||||
let req = tools.getReqByPar(idapp, usernameDest);
|
let req = tools.getReqByPar(idapp, usernameOrig);
|
||||||
await SendNotif.createNewNotifToSingleUser(req, null, { usernameDest: usernameOrig }, 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (ris) {
|
const userprofile = await User.getInfoFriendByUsername(idapp, usernameDest);
|
||||||
ris = await User.getInfoFriendByUsername(idapp, usernameDest);
|
const myuser = await User.getInfoFriendByUsername(idapp, usernameOrig);
|
||||||
//}
|
ris = {rec, userprofile, myuser };
|
||||||
} else if (cmd === shared_consts.FRIENDSCMD.REQFRIEND) {
|
} else if (cmd === shared_consts.FRIENDSCMD.REQFRIEND) {
|
||||||
// Aggiungo la richiesta di Amicizia a me
|
// Aggiungo la richiesta di Amicizia a me
|
||||||
const foundIfAlreadyAskFriend = await User.findOne({
|
const foundIfAlreadyAskFriend = await User.findOne({
|
||||||
@@ -2028,7 +2030,7 @@ UserSchema.statics.setFriendsCmd = async function (req, idapp, usernameOrig, use
|
|||||||
|
|
||||||
} else if (cmd === shared_consts.FRIENDSCMD.REMOVE_FROM_MYHANDSHAKE) {
|
} else if (cmd === shared_consts.FRIENDSCMD.REMOVE_FROM_MYHANDSHAKE) {
|
||||||
|
|
||||||
ris = await this.removeHandShake(idapp, usernameOrig, usernameDest); // Rimuovo l'Amicizia da lui
|
ris = await this.removeHandShake(idapp, usernameDest, usernameOrig); // Rimuovo l'Amicizia da lui
|
||||||
|
|
||||||
} else if (cmd === shared_consts.FRIENDSCMD.CANCEL_REQ_FRIEND) {
|
} else if (cmd === shared_consts.FRIENDSCMD.CANCEL_REQ_FRIEND) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user