mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2025-03-04 07:18:50 -07:00
parent
12216d8d44
commit
37c21dc821
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…
Add table
Reference in a new issue