summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/convert
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 /routers/api/v1/convert
parent0f33b04c876593e592887450302774654fef2787 (diff)
downloadgitea-3f7f4852efaaa56a0dada832dc652a1fc8869ae7.tar.gz
gitea-3f7f4852efaaa56a0dada832dc652a1fc8869ae7.zip
#2246 fully support of webhooks for pull request
Diffstat (limited to 'routers/api/v1/convert')
-rw-r--r--routers/api/v1/convert/convert.go25
1 files changed, 10 insertions, 15 deletions
diff --git a/routers/api/v1/convert/convert.go b/routers/api/v1/convert/convert.go
index cda1d86b45..c3ca9fd5d1 100644
--- a/routers/api/v1/convert/convert.go
+++ b/routers/api/v1/convert/convert.go
@@ -13,7 +13,6 @@ import (
api "github.com/gogits/go-gogs-client"
"github.com/gogits/gogs/models"
- "github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/setting"
)
@@ -48,16 +47,16 @@ func ToRepository(owner *models.User, repo *models.Repository, permission api.Pe
Description: repo.Description,
Private: repo.IsPrivate,
Fork: repo.IsFork,
- HtmlUrl: setting.AppUrl + owner.Name + "/" + repo.Name,
- CloneUrl: cl.HTTPS,
- SshUrl: cl.SSH,
+ HTMLURL: setting.AppUrl + owner.Name + "/" + repo.Name,
+ CloneURL: cl.HTTPS,
+ SSHURL: cl.SSH,
OpenIssues: repo.NumOpenIssues,
Stars: repo.NumStars,
Forks: repo.NumForks,
Watchers: repo.NumWatches,
Created: repo.Created,
Updated: repo.Updated,
- Permissions: permission,
+ Permissions: &permission,
}
}
@@ -183,7 +182,7 @@ func ToIssue(issue *models.Issue) *api.Issue {
ID: issue.ID,
Index: issue.Index,
State: issue.State(),
- Title: issue.Name,
+ Title: issue.Title,
Body: issue.Content,
User: ToUser(issue.Poster),
Labels: apiLabels,
@@ -194,15 +193,11 @@ func ToIssue(issue *models.Issue) *api.Issue {
Updated: issue.Updated,
}
if issue.IsPull {
- if err := issue.GetPullRequest(); err != nil {
- log.Error(4, "GetPullRequest", err)
- } else {
- apiIssue.PullRequest = &api.PullRequestMeta{
- HasMerged: issue.PullRequest.HasMerged,
- }
- if issue.PullRequest.HasMerged {
- apiIssue.PullRequest.Merged = &issue.PullRequest.Merged
- }
+ apiIssue.PullRequest = &api.PullRequestMeta{
+ HasMerged: issue.PullRequest.HasMerged,
+ }
+ if issue.PullRequest.HasMerged {
+ apiIssue.PullRequest.Merged = &issue.PullRequest.Merged
}
}