Selaa lähdekoodia

changed property name to UserWasDeleted and added an assert for it

Torkel Ödegaard 7 vuotta sitten
vanhempi
commit
b671b9704f

+ 3 - 3
pkg/api/org_users.go

@@ -103,8 +103,8 @@ func updateOrgUserHelper(cmd m.UpdateOrgUserCommand) Response {
 // DELETE /api/org/users/:userId
 func RemoveOrgUserForCurrentOrg(c *m.ReqContext) Response {
 	return removeOrgUserHelper(&m.RemoveOrgUserCommand{
-		UserId:                   c.ParamsInt64(":userId"),
-		OrgId:                    c.OrgId,
+		UserId: c.ParamsInt64(":userId"),
+		OrgId:  c.OrgId,
 		ShouldDeleteOrphanedUser: true,
 	})
 }
@@ -125,7 +125,7 @@ func removeOrgUserHelper(cmd *m.RemoveOrgUserCommand) Response {
 		return Error(500, "Failed to remove user from organization", err)
 	}
 
-	if cmd.UserWasRemoved {
+	if cmd.UserWasDeleted {
 		return Success("User deleted")
 	}
 

+ 1 - 1
pkg/models/org_user.go

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

+ 1 - 0
pkg/services/sqlstore/org_test.go

@@ -191,6 +191,7 @@ func TestAccountDataAccess(t *testing.T) {
 					remCmd := m.RemoveOrgUserCommand{OrgId: ac1.OrgId, UserId: ac2.Id, ShouldDeleteOrphanedUser: true}
 					err = RemoveOrgUser(&remCmd)
 					So(err, ShouldBeNil)
+					So(remCmd.UserWasDeleted, ShouldBeTrue)
 
 					err = GetSignedInUser(&m.GetSignedInUserQuery{UserId: ac2.Id})
 					So(err, ShouldEqual, m.ErrUserNotFound)

+ 1 - 1
pkg/services/sqlstore/org_users.go

@@ -195,7 +195,7 @@ func RemoveOrgUser(cmd *m.RemoveOrgUserCommand) error {
 				return err
 			}
 
-			cmd.UserWasRemoved = true
+			cmd.UserWasDeleted = true
 		}
 
 		return nil