When banning without commentid.

This commit is contained in:
gaba
2016-11-21 12:42:14 -08:00
parent 3337e95a6c
commit 8355f441e3
2 changed files with 15 additions and 0 deletions
+1
View File
@@ -441,6 +441,7 @@ UserService.ban = (id, comment_id) => {
.then(() => {
// Set status of the user to banned
return UserService.setStatus(id, 'banned').then(() => {
// Only if it was rejected based on a specific comment.
// Reject the comment that the user was ban for.
return Comment.setStatus(comment_id, 'rejected');
});
+14
View File
@@ -123,5 +123,19 @@ describe('User: models', () => {
});
});
});
it('should not still disable and ban the user if there is no comment', () => {
return User
.ban(mockUsers[0].id, '')
.then(() => {
User.findById(mockUsers[0].id)
.then((user) => {
expect(user).to.have.property('status')
.and.to.equal('banned');
expect(user).to.have.property('disabled')
.and.to.equal(true);
});
});
});
});
});