Fix team user api (#8172)

* fix team user api

* fix tests

* fix api

* fix team user api

* change user convert

* fix tests

* fix tests
This commit is contained in:
Lunny Xiao 2019-09-15 20:22:02 +08:00 committed by GitHub
parent 8b54b58bc5
commit be0f7ff9bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 45 additions and 0 deletions

View file

@ -287,6 +287,15 @@ func GetTeamMember(ctx *context.APIContext) {
if ctx.Written() {
return
}
teamID := ctx.ParamsInt64("teamid")
isTeamMember, err := models.IsUserInTeams(u.ID, []int64{teamID})
if err != nil {
ctx.Error(500, "IsUserInTeams", err)
return
} else if !isTeamMember {
ctx.NotFound()
return
}
ctx.JSON(200, convert.ToUser(u, ctx.IsSigned, ctx.User.IsAdmin))
}