added the UserWasRemoved flag to make api aware of what happened to return correct message to UI

This commit is contained in:
Torkel Ödegaard 2018-10-11 07:58:22 +02:00
parent 5b5cb6622d
commit 9585dc7825
3 changed files with 7 additions and 0 deletions

View File

@ -125,5 +125,9 @@ func removeOrgUserHelper(cmd *m.RemoveOrgUserCommand) Response {
return Error(500, "Failed to remove user from organization", err)
}
if cmd.UserWasRemoved {
return Success("User deleted")
}
return Success("User removed from organization")
}

View File

@ -75,6 +75,7 @@ type RemoveOrgUserCommand struct {
UserId int64
OrgId int64
ShouldDeleteOrphanedUser bool
UserWasRemoved bool
}
type AddOrgUserCommand struct {

View File

@ -194,6 +194,8 @@ func RemoveOrgUser(cmd *m.RemoveOrgUserCommand) error {
if err := deleteUserInTransaction(sess, &m.DeleteUserCommand{UserId: user.Id}); err != nil {
return err
}
cmd.UserWasRemoved = true
}
return nil