浏览代码

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

Torkel Ödegaard 7 年之前
父节点
当前提交
9585dc7825
共有 3 个文件被更改,包括 7 次插入0 次删除
  1. 4 0
      pkg/api/org_users.go
  2. 1 0
      pkg/models/org_user.go
  3. 2 0
      pkg/services/sqlstore/org_users.go

+ 4 - 0
pkg/api/org_users.go

@@ -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")
 }

+ 1 - 0
pkg/models/org_user.go

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

+ 2 - 0
pkg/services/sqlstore/org_users.go

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