diff options
author | Unknwon <u@gogs.io> | 2016-08-14 04:17:26 -0700 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-08-14 04:17:26 -0700 |
commit | dccb0c15b996ac4dc0307cbfed140ce1558d7e3c (patch) | |
tree | 97593eae3a1023296c2c03258e6bc4ae4c02b6bf /models/webhook_slack.go | |
parent | 3f7f4852efaaa56a0dada832dc652a1fc8869ae7 (diff) | |
download | gitea-dccb0c15b996ac4dc0307cbfed140ce1558d7e3c.tar.gz gitea-dccb0c15b996ac4dc0307cbfed140ce1558d7e3c.zip |
Replace convert.To with APIFormat calls
Diffstat (limited to 'models/webhook_slack.go')
-rw-r--r-- | models/webhook_slack.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/models/webhook_slack.go b/models/webhook_slack.go index 5578c816a5..edc26a78f3 100644 --- a/models/webhook_slack.go +++ b/models/webhook_slack.go @@ -76,8 +76,8 @@ func getSlackCreatePayload(p *api.CreatePayload, slack *SlackMeta) (*SlackPayloa // created tag/branch refName := git.RefEndName(p.Ref) - repoLink := SlackLinkFormatter(p.Repo.URL, p.Repo.Name) - refLink := SlackLinkFormatter(p.Repo.URL+"/src/"+refName, refName) + repoLink := SlackLinkFormatter(p.Repo.HTMLURL, p.Repo.Name) + refLink := SlackLinkFormatter(p.Repo.HTMLURL+"/src/"+refName, refName) text := fmt.Sprintf("[%s:%s] %s created by %s", repoLink, refLink, p.RefType, p.Sender.UserName) return &SlackPayload{ @@ -101,15 +101,15 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e } else { commitDesc = fmt.Sprintf("%d new commits", len(p.Commits)) } - if len(p.CompareUrl) > 0 { - commitString = SlackLinkFormatter(p.CompareUrl, commitDesc) + if len(p.CompareURL) > 0 { + commitString = SlackLinkFormatter(p.CompareURL, commitDesc) } else { commitString = commitDesc } - repoLink := SlackLinkFormatter(p.Repo.URL, p.Repo.Name) - branchLink := SlackLinkFormatter(p.Repo.URL+"/src/"+branchName, branchName) - text := fmt.Sprintf("[%s:%s] %s pushed by %s", repoLink, branchLink, commitString, p.Pusher.Name) + repoLink := SlackLinkFormatter(p.Repo.HTMLURL, p.Repo.Name) + branchLink := SlackLinkFormatter(p.Repo.HTMLURL+"/src/"+branchName, branchName) + text := fmt.Sprintf("[%s:%s] %s pushed by %s", repoLink, branchLink, commitString, p.Pusher.UserName) var attachmentText string // for each commit, generate attachment text @@ -135,7 +135,7 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e func getSlackPullRequestPayload(p *api.PullRequestPayload, slack *SlackMeta) (*SlackPayload, error) { senderLink := SlackLinkFormatter(setting.AppUrl+p.Sender.UserName, p.Sender.UserName) - titleLink := SlackLinkFormatter(fmt.Sprintf("%s/%d", setting.AppUrl+p.Repository.FullName+"/pulls", p.Index), + titleLink := SlackLinkFormatter(fmt.Sprintf("%s/pulls/%d", p.Repository.HTMLURL, p.Index), fmt.Sprintf("#%d %s", p.Index, p.PullRequest.Title)) var text, title, attachmentText string switch p.Action { |