Merge pull request #1967 from ywk253100/170407_role

Fixes out of range bug when listing projects
This commit is contained in:
Daniel Jiang 2017-04-07 20:09:30 +08:00 committed by GitHub
commit 3543a4742f

View File

@ -302,7 +302,10 @@ func (p *ProjectAPI) List() {
log.Errorf("failed to get user's project role: %v", err)
p.CustomAbort(http.StatusInternalServerError, "")
}
projectList[i].Role = roles[0].RoleID
if len(roles) != 0 {
projectList[i].Role = roles[0].RoleID
}
if projectList[i].Role == models.PROJECTADMIN ||
isAdmin {
projectList[i].Togglable = true