fix: Group membership count off after suspending users in groups (#1670)

* fix: Clear group memberships when suspending a user
Refactor to command

* test

* test
This commit is contained in:
Tom Moor
2020-11-22 11:21:47 -08:00
committed by GitHub
parent 273d9c4680
commit 56d5f048f9
4 changed files with 104 additions and 19 deletions

View File

@ -205,15 +205,6 @@ Team.prototype.removeAdmin = async function (user: User) {
}
};
Team.prototype.suspendUser = async function (user: User, admin: User) {
if (user.id === admin.id)
throw new ValidationError("Unable to suspend the current user");
return user.update({
suspendedById: admin.id,
suspendedAt: new Date(),
});
};
Team.prototype.activateUser = async function (user: User, admin: User) {
return user.update({
suspendedById: null,