fix wrong slack webhook payload URL

This commit is contained in:
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
- 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

View file

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

View file

@ -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())

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -1 +1 @@
0.7.33.1205 Beta
0.7.33.1206 Beta