aboutsummaryrefslogtreecommitdiffstats
path: root/routers/private
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-08-30 08:24:39 +0100
committerGitHub <noreply@github.com>2020-08-30 08:24:39 +0100
commitd257485bc0026c9717fe7bf4c9953ad1b7a1a9ae (patch)
tree701493ea83b4f416c5e7ea6ffd5a9dd291d44d03 /routers/private
parent17fbbe97d7b4fca45d112f924191600eff52957b (diff)
downloadgitea-d257485bc0026c9717fe7bf4c9953ad1b7a1a9ae.tar.gz
gitea-d257485bc0026c9717fe7bf4c9953ad1b7a1a9ae.zip
Rename models.ProtectedBranchRepoID to models.EnvRepoID and ensure EnvPusherEmail is set (#12646)
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers/private')
-rw-r--r--routers/private/serv.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/routers/private/serv.go b/routers/private/serv.go
index 2e79fd79ac..f463ff6828 100644
--- a/routers/private/serv.go
+++ b/routers/private/serv.go
@@ -217,6 +217,18 @@ func ServCommand(ctx *macaron.Context) {
// so for now use the owner of the repository
results.UserName = results.OwnerName
results.UserID = repo.OwnerID
+ if err = repo.GetOwner(); err != nil {
+ log.Error("Unable to get owner for repo %-v. Error: %v", repo, err)
+ ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
+ "results": results,
+ "type": "InternalServerError",
+ "err": fmt.Sprintf("Unable to get owner for repo: %s/%s.", results.OwnerName, results.RepoName),
+ })
+ return
+ }
+ if !repo.Owner.KeepEmailPrivate {
+ results.UserEmail = repo.Owner.Email
+ }
} else {
// Get the user represented by the Key
var err error
@@ -239,6 +251,9 @@ func ServCommand(ctx *macaron.Context) {
return
}
results.UserName = user.Name
+ if !user.KeepEmailPrivate {
+ results.UserEmail = user.Email
+ }
}
// Don't allow pushing if the repo is archived