mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-11-30 07:48:09 +09:00
parent
12216d8d44
commit
37c21dc821
@ -31,6 +31,16 @@ module.exports = (params, user) =>
|
|||||||
// Get 'user_id' parameter
|
// Get 'user_id' parameter
|
||||||
let recipient = params.user_id;
|
let recipient = params.user_id;
|
||||||
if (recipient !== undefined && recipient !== null) {
|
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({
|
recipient = await User.findOne({
|
||||||
_id: new mongo.ObjectID(recipient)
|
_id: new mongo.ObjectID(recipient)
|
||||||
}, {
|
}, {
|
||||||
|
Loading…
Reference in New Issue
Block a user