Prevent user from blocking himself - fixes #9097 (#9194)

* Added check - user can't block himself

* removed exclusive test
This commit is contained in:
borisabramovich86
2017-10-18 23:26:01 +03:00
committed by Sabe Jones
parent 444f393f3a
commit 15626b8ae1
3 changed files with 11 additions and 0 deletions

View File

@@ -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) {