Просмотр исходного кода

fix wrong slack webhook payload URL

Unknwon лет назад: 8
Родитель
Сommit
dce2a9e7e1
7 измененных файлов с 16 добавлено и 7 удалено
  1. 1 1
      README.md
  2. 1 1
      README_ZH.md
  3. 1 1
      gogs.go
  4. 1 1
      models/action.go
  5. 5 1
      models/repo.go
  6. 6 1
      routers/repo/webhook.go
  7. 1 1
      templates/.VERSION

+ 1 - 1
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

+ 1 - 1
README_ZH.md

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

+ 1 - 1
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())

+ 1 - 1
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,

+ 5 - 1
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,

+ 6 - 1
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,

+ 1 - 1
templates/.VERSION

@@ -1 +1 @@
-0.7.33.1205 Beta
+0.7.33.1206 Beta