From 73d05a51e3dce4a5b31b8660a6141a14ae615404 Mon Sep 17 00:00:00 2001 From: Ethan Koenig Date: Thu, 2 Feb 2017 07:33:56 -0500 Subject: [PATCH] Remove unneeded database loads (#814) Remove unnecessary calls to repo.GetOwner() in context handlers --- modules/context/repo.go | 4 +--- routers/api/v1/api.go | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/context/repo.go b/modules/context/repo.go index 338a78cb93c..aca1e1b63c2 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -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 { diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 67912e15d7a..07180c9a5cd 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -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