summaryrefslogtreecommitdiffstats
path: root/models/action.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-14 03:32:24 -0700
committerUnknwon <u@gogs.io>2016-08-14 03:32:24 -0700
commit3f7f4852efaaa56a0dada832dc652a1fc8869ae7 (patch)
treee3bb1769b2967dea560b2400abf830dc6cf70067 /models/action.go
parent0f33b04c876593e592887450302774654fef2787 (diff)
downloadgitea-3f7f4852efaaa56a0dada832dc652a1fc8869ae7.tar.gz
gitea-3f7f4852efaaa56a0dada832dc652a1fc8869ae7.zip
#2246 fully support of webhooks for pull request
Diffstat (limited to 'models/action.go')
-rw-r--r--models/action.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/models/action.go b/models/action.go
index 5bfa5b75b2..584543d9c1 100644
--- a/models/action.go
+++ b/models/action.go
@@ -169,7 +169,7 @@ func (a *Action) GetIssueTitle() string {
log.Error(4, "GetIssueByIndex: %v", err)
return "500 when get issue"
}
- return issue.Name
+ return issue.Title
}
func (a *Action) GetIssueContent() string {
@@ -513,11 +513,11 @@ func CommitRepoAction(
payloadRepo := repo.ComposePayload()
- pusher_email, pusher_name := "", ""
+ var pusherEmail, pusherName string
pusher, err := GetUserByName(userName)
if err == nil {
- pusher_email = pusher.Email
- pusher_name = pusher.DisplayName()
+ pusherEmail = pusher.Email
+ pusherName = pusher.DisplayName()
}
payloadSender := &api.PayloadUser{
UserName: pusher.Name,
@@ -527,7 +527,7 @@ func CommitRepoAction(
switch opType {
case ACTION_COMMIT_REPO: // Push
- p := &api.PushPayload{
+ if err = PrepareWebhooks(repo, HOOK_EVENT_PUSH, &api.PushPayload{
Ref: refFullName,
Before: oldCommitID,
After: newCommitID,
@@ -535,13 +535,12 @@ func CommitRepoAction(
Commits: commit.ToApiPayloadCommits(repo.FullLink()),
Repo: payloadRepo,
Pusher: &api.PayloadAuthor{
- Name: pusher_name,
- Email: pusher_email,
+ Name: pusherName,
+ Email: pusherEmail,
UserName: userName,
},
Sender: payloadSender,
- }
- if err = PrepareWebhooks(repo, HOOK_EVENT_PUSH, p); err != nil {
+ }); err != nil {
return fmt.Errorf("PrepareWebhooks: %v", err)
}
@@ -603,7 +602,7 @@ func mergePullRequestAction(e Engine, actUser *User, repo *Repository, pull *Iss
ActUserName: actUser.Name,
ActEmail: actUser.Email,
OpType: ACTION_MERGE_PULL_REQUEST,
- Content: fmt.Sprintf("%d|%s", pull.Index, pull.Name),
+ Content: fmt.Sprintf("%d|%s", pull.Index, pull.Title),
RepoID: repo.ID,
RepoUserName: repo.Owner.Name,
RepoName: repo.Name,