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

@@ -25,6 +25,15 @@ describe('shared.ops.blockUser', () => {
}
});
it('validates user can\'t block himself', (done) => {
try {
blockUser(user, { params: { uuid: user._id } });
} catch (error) {
expect(error.message).to.eql(i18n.t('blockYourself'));
done();
}
});
it('blocks user', () => {
let [result] = blockUser(user, { params: { uuid: blockedUser._id } });
expect(user.inbox.blocks).to.eql([blockedUser._id]);