fix wrong slack webhook payload URL

release/v1.15
Unknwon 2015-12-06 23:07:02 -05:00
parent abb02889f2
commit dce2a9e7e1
7 changed files with 16 additions and 7 deletions

View File

@ -46,7 +46,7 @@ The goal of this project is to make the easiest, fastest, and most painless way
- Account/Organization/Repository management - Account/Organization/Repository management
- Repository/Organization webhooks (including Slack) - Repository/Organization webhooks (including Slack)
- Repository Git hooks/deploy keys - Repository Git hooks/deploy keys
- Repository issues and pull requests - Repository issues, pull requests and wiki
- Add/Remove repository collaborators - Add/Remove repository collaborators
- Gravatar and custom source - Gravatar and custom source
- Mail service - Mail service

View File

@ -24,7 +24,7 @@ Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自
- 支持用户、组织和仓库管理系统 - 支持用户、组织和仓库管理系统
- 支持仓库和组织级别 Web 钩子(包括 Slack 集成) - 支持仓库和组织级别 Web 钩子(包括 Slack 集成)
- 支持仓库 Git 钩子和部署密钥 - 支持仓库 Git 钩子和部署密钥
- 支持仓库工单Issue和合并请求Pull Request - 支持仓库工单Issue、合并请求Pull Request以及 Wiki
- 支持添加和删除仓库协作者 - 支持添加和删除仓库协作者
- 支持 Gravatar 以及自定义源 - 支持 Gravatar 以及自定义源
- 支持邮件服务 - 支持邮件服务

View File

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.7.33.1205 Beta" const APP_VER = "0.7.33.1206 Beta"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

View File

@ -479,7 +479,7 @@ func CommitRepoAction(
commits[i] = &api.PayloadCommit{ commits[i] = &api.PayloadCommit{
ID: cmt.Sha1, ID: cmt.Sha1,
Message: cmt.Message, 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{ Author: &api.PayloadAuthor{
Name: cmt.AuthorName, Name: cmt.AuthorName,
Email: cmt.AuthorEmail, Email: cmt.AuthorEmail,

View File

@ -305,6 +305,10 @@ func (repo *Repository) RepoLink() string {
return setting.AppSubUrl + "/" + repo.MustOwner().Name + "/" + repo.Name 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 { func (repo *Repository) HasAccess(u *User) bool {
has, _ := HasAccess(u, repo, ACCESS_MODE_READ) has, _ := HasAccess(u, repo, ACCESS_MODE_READ)
return has return has
@ -387,7 +391,7 @@ func (repo *Repository) ComposePayload() *api.PayloadRepo {
return &api.PayloadRepo{ return &api.PayloadRepo{
ID: repo.ID, ID: repo.ID,
Name: repo.LowerName, Name: repo.LowerName,
URL: repo.RepoLink(), URL: repo.FullRepoLink(),
SSHURL: cl.SSH, SSHURL: cl.SSH,
CloneURL: cl.HTTPS, CloneURL: cl.HTTPS,
Description: repo.Description, Description: repo.Description,

View File

@ -348,7 +348,7 @@ func TestWebhook(ctx *middleware.Context) {
{ {
ID: ctx.Repo.CommitID, ID: ctx.Repo.CommitID,
Message: ctx.Repo.Commit.Message(), 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{ Author: &api.PayloadAuthor{
Name: ctx.Repo.Commit.Author.Name, Name: ctx.Repo.Commit.Author.Name,
Email: ctx.Repo.Commit.Author.Email, Email: ctx.Repo.Commit.Author.Email,
@ -356,6 +356,11 @@ func TestWebhook(ctx *middleware.Context) {
}, },
}, },
Repo: ctx.Repo.Repository.ComposePayload(), Repo: ctx.Repo.Repository.ComposePayload(),
Pusher: &api.PayloadAuthor{
Name: ctx.User.Name,
Email: ctx.User.Email,
UserName: ctx.User.Name,
},
Sender: &api.PayloadUser{ Sender: &api.PayloadUser{
UserName: ctx.User.Name, UserName: ctx.User.Name,
ID: ctx.User.Id, ID: ctx.User.Id,

View File

@ -1 +1 @@
0.7.33.1205 Beta 0.7.33.1206 Beta