From 338af89d5641008be579df9c554d0a1db190a009 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Wed, 17 Feb 2016 22:47:06 -0500 Subject: #2650 fix possbility that use email as pusher user name Remove the possibility of using email as user name when user actually push through combination of email and password with HTTP. Also refactor update action function to replcae tons of arguments with single PushUpdateOptions struct. And define the user who pushes code as pusher, therefore variable names shouldn't be confusing any more. --- routers/repo/http.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'routers/repo/http.go') diff --git a/routers/repo/http.go b/routers/repo/http.go index 5e81e73cec..f9600c94de 100644 --- a/routers/repo/http.go +++ b/routers/repo/http.go @@ -134,7 +134,6 @@ func HTTP(ctx *middleware.Context) { ctx.Handle(500, "GetUserByID", err) return } - authUsername = authUser.Name } if !isPublicPull { @@ -202,7 +201,15 @@ func HTTP(ctx *middleware.Context) { refName := fields[2] // FIXME: handle error. - if err = models.Update(refName, oldCommitId, newCommitId, authUsername, username, reponame, authUser.Id); err == nil { + if err = models.PushUpdate(models.PushUpdateOptions{ + RefName: refName, + OldCommitID: oldCommitId, + NewCommitID: newCommitId, + PusherID: authUser.Id, + PusherName: authUser.Name, + RepoUserName: username, + RepoName: reponame, + }); err == nil { go models.HookQueue.Add(repo.ID) go models.AddTestPullRequestTask(repo.ID, strings.TrimPrefix(refName, "refs/heads/")) } -- cgit v1.2.3