add missing Email from Hook Event in gitea. (#2080)

* add missing Email from Hook Event in gitea.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* fix field.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* fix avatar path

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* fix testing

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2017-06-20 23:53:47 -05:00 committed by Brad Rydzewski
parent eed03a5803
commit b833b16f32
4 changed files with 7 additions and 1 deletions

View file

@ -39,11 +39,13 @@ const HookPush = `
"pusher": {
"name": "gordon",
"email": "gordon@golang.org",
"username": "gordon"
"username": "gordon",
"login": "gordon"
},
"sender": {
"login": "gordon",
"id": 1,
"username": "gordon",
"avatar_url": "http://gitea.golang.org///1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87"
}
}

View file

@ -88,6 +88,7 @@ func buildFromPush(hook *pushHook) *model.Build {
Message: hook.Commits[0].Message,
Avatar: avatar,
Author: author,
Email: hook.Pusher.Email,
Timestamp: time.Now().UTC().Unix(),
Sender: sender,
}

View file

@ -33,7 +33,9 @@ func Test_parse(t *testing.T) {
g.Assert(hook.Pusher.Name).Equal("gordon")
g.Assert(hook.Pusher.Email).Equal("gordon@golang.org")
g.Assert(hook.Pusher.Username).Equal("gordon")
g.Assert(hook.Pusher.Login).Equal("gordon")
g.Assert(hook.Sender.Login).Equal("gordon")
g.Assert(hook.Sender.Username).Equal("gordon")
g.Assert(hook.Sender.Avatar).Equal("http://gitea.golang.org///1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87")
})

View file

@ -88,6 +88,7 @@ func buildFromPush(hook *pushHook) *model.Build {
Message: hook.Commits[0].Message,
Avatar: avatar,
Author: author,
Email: hook.Pusher.Email,
Timestamp: time.Now().UTC().Unix(),
Sender: sender,
}