From dce2a9e7e1146293f711c0dbd9725ac7eb0b8a16 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sun, 6 Dec 2015 23:07:02 -0500 Subject: [PATCH] fix wrong slack webhook payload URL --- README.md | 2 +- README_ZH.md | 2 +- gogs.go | 2 +- models/action.go | 2 +- models/repo.go | 6 +++++- routers/repo/webhook.go | 7 ++++++- templates/.VERSION | 2 +- 7 files changed, 16 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 4d6348904..1900980cb 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ The goal of this project is to make the easiest, fastest, and most painless way - Account/Organization/Repository management - Repository/Organization webhooks (including Slack) - Repository Git hooks/deploy keys -- Repository issues and pull requests +- Repository issues, pull requests and wiki - Add/Remove repository collaborators - Gravatar and custom source - Mail service diff --git a/README_ZH.md b/README_ZH.md index b3446c13a..d39c132b0 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -24,7 +24,7 @@ Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自 - 支持用户、组织和仓库管理系统 - 支持仓库和组织级别 Web 钩子(包括 Slack 集成) - 支持仓库 Git 钩子和部署密钥 -- 支持仓库工单(Issue)和合并请求(Pull Request) +- 支持仓库工单(Issue)、合并请求(Pull Request)以及 Wiki - 支持添加和删除仓库协作者 - 支持 Gravatar 以及自定义源 - 支持邮件服务 diff --git a/gogs.go b/gogs.go index ab13a0bca..b77540a7f 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.7.33.1205 Beta" +const APP_VER = "0.7.33.1206 Beta" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/models/action.go b/models/action.go index c54b180bc..bb5860a66 100644 --- a/models/action.go +++ b/models/action.go @@ -479,7 +479,7 @@ func CommitRepoAction( commits[i] = &api.PayloadCommit{ ID: cmt.Sha1, Message: cmt.Message, - URL: fmt.Sprintf("%s/commit/%s", repo.RepoLink(), cmt.Sha1), + URL: fmt.Sprintf("%s/commit/%s", repo.FullRepoLink(), cmt.Sha1), Author: &api.PayloadAuthor{ Name: cmt.AuthorName, Email: cmt.AuthorEmail, diff --git a/models/repo.go b/models/repo.go index 5b66d2c0b..25f66600a 100644 --- a/models/repo.go +++ b/models/repo.go @@ -305,6 +305,10 @@ func (repo *Repository) RepoLink() string { return setting.AppSubUrl + "/" + repo.MustOwner().Name + "/" + repo.Name } +func (repo *Repository) FullRepoLink() string { + return setting.AppUrl + repo.MustOwner().Name + "/" + repo.Name +} + func (repo *Repository) HasAccess(u *User) bool { has, _ := HasAccess(u, repo, ACCESS_MODE_READ) return has @@ -387,7 +391,7 @@ func (repo *Repository) ComposePayload() *api.PayloadRepo { return &api.PayloadRepo{ ID: repo.ID, Name: repo.LowerName, - URL: repo.RepoLink(), + URL: repo.FullRepoLink(), SSHURL: cl.SSH, CloneURL: cl.HTTPS, Description: repo.Description, diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go index b93d6fc28..458670ad2 100644 --- a/routers/repo/webhook.go +++ b/routers/repo/webhook.go @@ -348,7 +348,7 @@ func TestWebhook(ctx *middleware.Context) { { ID: ctx.Repo.CommitID, Message: ctx.Repo.Commit.Message(), - URL: ctx.Repo.RepoLink + "/commit/" + ctx.Repo.CommitID, + URL: ctx.Repo.Repository.FullRepoLink() + "/commit/" + ctx.Repo.CommitID, Author: &api.PayloadAuthor{ Name: ctx.Repo.Commit.Author.Name, Email: ctx.Repo.Commit.Author.Email, @@ -356,6 +356,11 @@ func TestWebhook(ctx *middleware.Context) { }, }, Repo: ctx.Repo.Repository.ComposePayload(), + Pusher: &api.PayloadAuthor{ + Name: ctx.User.Name, + Email: ctx.User.Email, + UserName: ctx.User.Name, + }, Sender: &api.PayloadUser{ UserName: ctx.User.Name, ID: ctx.User.Id, diff --git a/templates/.VERSION b/templates/.VERSION index 6812c1e46..6b777ab5a 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.7.33.1205 Beta \ No newline at end of file +0.7.33.1206 Beta \ No newline at end of file