added validation for blocked users when inviting to groups by username (#14316)
This commit is contained in:
@@ -207,6 +207,13 @@ async function inviteByUserName (username, group, inviter, req, res) {
|
||||
throw new BadRequest(res.t('cannotInviteSelfToGroup'));
|
||||
}
|
||||
|
||||
const objections = inviter.getObjectionsToInteraction('group-invitation', userToInvite);
|
||||
if (objections.length > 0) {
|
||||
throw new NotAuthorized(res.t(
|
||||
objections[0],
|
||||
{ userId: userToInvite._id, username: userToInvite.profile.name },
|
||||
));
|
||||
}
|
||||
return addInvitationToUser(userToInvite, group, inviter, res);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user