mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 14:17:22 +01:00
* Added check - user can't block himself * removed exclusive test
This commit is contained in:
committed by
Sabe Jones
parent
444f393f3a
commit
15626b8ae1
@@ -6,6 +6,7 @@ import {
|
||||
|
||||
module.exports = function blockUser (user, req = {}) {
|
||||
if (!validator.isUUID(req.params.uuid)) throw new BadRequest(i18n.t('invalidUUID', req.language));
|
||||
if (req.params.uuid === user._id) throw new BadRequest(i18n.t('blockYourself', req.language));
|
||||
|
||||
let i = user.inbox.blocks.indexOf(req.params.uuid);
|
||||
if (i === -1) {
|
||||
|
||||
Reference in New Issue
Block a user