mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-24 02:23:08 +02:00
parent
76aaa340a3
commit
e407cca90b
1 changed files with 10 additions and 0 deletions
|
@ -31,6 +31,16 @@ module.exports = (params, user) =>
|
|||
// Get 'user_id' parameter
|
||||
let recipient = params.user_id;
|
||||
if (recipient !== undefined && recipient !== null) {
|
||||
// Validate id
|
||||
if (!mongo.ObjectID.isValid(recipient)) {
|
||||
return rej('incorrect user_id');
|
||||
}
|
||||
|
||||
// Myself
|
||||
if (new mongo.ObjectID(recipient).equals(user._id)) {
|
||||
return rej('-need-translate-');
|
||||
}
|
||||
|
||||
recipient = await User.findOne({
|
||||
_id: new mongo.ObjectID(recipient)
|
||||
}, {
|
||||
|
|
Loading…
Reference in a new issue