(fixes #1008) pusher of webhook push event is not same as github's it

This commit is contained in:
nazoking
2015-12-16 21:41:14 +09:00
parent c6f4ec7250
commit 10b5de571e
2 changed files with 16 additions and 3 deletions

View File

@@ -0,0 +1,11 @@
package gitbucket.core.api
import gitbucket.core.model.Account
case class ApiPusher(name: String, email: String)
object ApiPusher {
def apply(user: Account): ApiPusher = ApiPusher(
name = user.userName,
email = user.mailAddress)
}

View File

@@ -272,7 +272,8 @@ object WebHookService {
// https://developer.github.com/v3/activity/events/types/#pushevent // https://developer.github.com/v3/activity/events/types/#pushevent
case class WebHookPushPayload( case class WebHookPushPayload(
pusher: ApiUser, pusher: ApiPusher,
sender: ApiUser,
ref: String, ref: String,
before: String, before: String,
after: String, after: String,
@@ -289,11 +290,12 @@ object WebHookService {
} }
object WebHookPushPayload { object WebHookPushPayload {
def apply(git: Git, pusher: Account, refName: String, repositoryInfo: RepositoryInfo, def apply(git: Git, sender: Account, refName: String, repositoryInfo: RepositoryInfo,
commits: List[CommitInfo], repositoryOwner: Account, commits: List[CommitInfo], repositoryOwner: Account,
newId: ObjectId, oldId: ObjectId): WebHookPushPayload = newId: ObjectId, oldId: ObjectId): WebHookPushPayload =
WebHookPushPayload( WebHookPushPayload(
pusher = ApiUser(pusher), pusher = ApiPusher(sender),
sender = ApiUser(sender),
ref = refName, ref = refName,
before = ObjectId.toString(oldId), before = ObjectId.toString(oldId),
after = ObjectId.toString(newId), after = ObjectId.toString(newId),