Skip to content

Commit

Permalink
Remove unneeded database loads (go-gitea#814)
Browse files Browse the repository at this point in the history
Remove unnecessary calls to repo.GetOwner() in context handlers
  • Loading branch information
ethantkoenig authored and lunny committed Feb 2, 2017
1 parent d7d094b commit 73d05a5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions modules/context/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,8 @@ func RepoAssignment(args ...bool) macaron.Handler {
ctx.Handle(500, "GetRepositoryByName", err)
}
return
} else if err = repo.GetOwner(); err != nil {
ctx.Handle(500, "GetOwner", err)
return
}
repo.Owner = owner

// Admin has super access.
if ctx.IsSigned && ctx.User.IsAdmin {
Expand Down
4 changes: 1 addition & 3 deletions routers/api/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ func repoAssignment() macaron.Handler {
ctx.Error(500, "GetRepositoryByName", err)
}
return
} else if err = repo.GetOwner(); err != nil {
ctx.Error(500, "GetOwner", err)
return
}
repo.Owner = owner

if ctx.IsSigned && ctx.User.IsAdmin {
ctx.Repo.AccessMode = models.AccessModeOwner
Expand Down

0 comments on commit 73d05a5

Please sign in to comment.