Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for corporate WeChat webhooks #15910

Merged
merged 83 commits into from
Jul 23, 2021
Merged

Add support for corporate WeChat webhooks #15910

merged 83 commits into from
Jul 23, 2021

Conversation

lengyuqu
Copy link
Contributor

这是一个企业微信的webhook 功能
1,提供了企业微信的webhook推送。
这对中国的工作者是有帮助的。这个功能我已经在我的公司使用了一年,由于中国的网络问题,一直没办法进行提交,希望可以获得合并。谢谢

This is a WebHook function of a company WeChat

  1. Provide WebHook push for corporate WeChat.
    This is helpful for Chinese workers. This feature I have been in my company for a year, because China's network problems have not been submitted, I hope I can get mergers. Thank you

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 17, 2021
@a1012112796 a1012112796 added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label May 18, 2021
lengyuqu and others added 3 commits May 18, 2021 21:40
Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: a1012112796 <1012112796@qq.com>
@a1012112796
Copy link
Member

Please fix lint

5	templates/admin/hook_new.tmpl:
30s
6		36: Wrong indentation type(spaces instead of tabs)
30s
7	templates/org/settings/hook_new.tmpl:
30s
8		31: Wrong indentation type(spaces instead of tabs)
30s
9	templates/repo/settings/webhook/base_list.tmpl:
30s
10		35: Wrong indentation type(spaces instead of tabs)
30s
11		36: Wrong indentation type(spaces instead of tabs)
30s
12	templates/repo/settings/webhook/new.tmpl:
30s
13		29: Wrong indentation type(spaces instead of tabs)
	services/webhook/wechatwork.go:61:1: receiver name f should be consistent with previous receiver name p for WechatworkPayload (golint)
162s
4	func (f *WechatworkPayload) Create(p *api.CreatePayload) (api.Payloader, error) {
162s
5	^
162s
6	services/webhook/wechatwork.go:70:1: receiver name f should be consistent with previous receiver name p for WechatworkPayload (golint)
162s
7	func (f *WechatworkPayload) Delete(p *api.DeletePayload) (api.Payloader, error) {
162s
8	^
162s
9	services/webhook/wechatwork.go:81:1: receiver name f should be consistent with previous receiver name p for WechatworkPayload (golint)
162s
10	func (f *WechatworkPayload) Fork(p *api.ForkPayload) (api.Payloader, error) {
162s
11	^
162s
12	services/webhook/wechatwork.go:105:3: S1021: should merge variable declaration with assignment on next line (gosimple)
162s
13			var message string
162s
14			^
162s
15	services/webhook/wechatwork.go:146:2: S1021: should merge variable declaration with assignment on next line (gosimple)
162s
16		var pr string
162s
17		^
162s
18	make: *** [Makefile:762: golangci-lint] Error 1

@go-gitea go-gitea deleted a comment from lengyuqu May 19, 2021
routers/routes/web.go Outdated Show resolved Hide resolved
@lengyuqu
Copy link
Contributor Author

请修理皮棉

5	templates/admin/hook_new.tmpl:
30s
6		36: Wrong indentation type(spaces instead of tabs)
30s
7	templates/org/settings/hook_new.tmpl:
30s
8		31: Wrong indentation type(spaces instead of tabs)
30s
9	templates/repo/settings/webhook/base_list.tmpl:
30s
10		35: Wrong indentation type(spaces instead of tabs)
30s
11		36: Wrong indentation type(spaces instead of tabs)
30s
12	templates/repo/settings/webhook/new.tmpl:
30s
13		29: Wrong indentation type(spaces instead of tabs)
	services/webhook/wechatwork.go:61:1: receiver name f should be consistent with previous receiver name p for WechatworkPayload (golint)
162s
4	func (f *WechatworkPayload) Create(p *api.CreatePayload) (api.Payloader, error) {
162s
5	^
162s
6	services/webhook/wechatwork.go:70:1: receiver name f should be consistent with previous receiver name p for WechatworkPayload (golint)
162s
7	func (f *WechatworkPayload) Delete(p *api.DeletePayload) (api.Payloader, error) {
162s
8	^
162s
9	services/webhook/wechatwork.go:81:1: receiver name f should be consistent with previous receiver name p for WechatworkPayload (golint)
162s
10	func (f *WechatworkPayload) Fork(p *api.ForkPayload) (api.Payloader, error) {
162s
11	^
162s
12	services/webhook/wechatwork.go:105:3: S1021: should merge variable declaration with assignment on next line (gosimple)
162s
13			var message string
162s
14			^
162s
15	services/webhook/wechatwork.go:146:2: S1021: should merge variable declaration with assignment on next line (gosimple)
162s
16		var pr string
162s
17		^
162s
18	make: *** [Makefile:762: golangci-lint] Error 1

It has been fixed

zhaoxin and others added 2 commits June 1, 2021 15:33
@techknowlogick techknowlogick changed the title Created a corporate WeChat Add support for corporate WeChat webhooks Jun 2, 2021
jpraet and others added 12 commits July 13, 2021 18:16
…6049)

* Add checkbox to delete pull branch after successful merge

* Omit DeleteBranchAfterMerge field in json

* Log a warning instead of error when PR head branch deleted

* Add DefaultDeleteBranchAfterMerge to PullRequestConfig

* Add support for delete_branch_after_merge via API

* Fix for API: the branch should be deleted from the HEAD repo

If head and base repo are the same, reuse the already opened ctx.Repo.GitRepo

* Don't delegate to CleanupBranch, only reuse branch deletion code

CleanupBranch contains too much logic that has already been performed by the Merge

* Reuse gitrepo in MergePullRequest

Co-authored-by: Andrew Thornton <art27@cantab.net>
* Detect encoding changes while parsing diff
* fix go-gitea#16384#

* refactor: move shared helper func to utils package

* extend Tests

* use ctx.Repo.GitRepo if not nil
@lengyuqu
Copy link
Contributor Author

@lenyuqu lint 失败。

I'm fixing this problem.

docs/content/doc/features/webhooks.zh-cn.md Outdated Show resolved Hide resolved
docs/content/doc/features/webhooks.zh-cn.md Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 21, 2021
@a1012112796 a1012112796 removed their request for review July 23, 2021 04:00
@lunny lunny merged commit 078e2b2 into go-gitea:main Jul 23, 2021
AbdulrhmnGhanem pushed a commit to kitspace/gitea that referenced this pull request Aug 10, 2021
* 企业微信webhook

* 企业微信webhook

* 企业微信webhook

* Update templates/admin/hook_new.tmpl

Co-authored-by: a1012112796 <1012112796@qq.com>

* Update services/webhook/wechatwork.go

Co-authored-by: a1012112796 <1012112796@qq.com>

* 修善wechatwork

* 修善wechatwork

* fix

* Update locale_cs-CZ.ini

fix

* fix build

* fix

* fix build

* make webhooks.zh-cn.md

* delet unnecessary blank line

* delet unnecessary blank line

* 企业微信webhook

* 企业微信webhook

* 企业微信webhook

* Update templates/admin/hook_new.tmpl

Co-authored-by: a1012112796 <1012112796@qq.com>

* Update services/webhook/wechatwork.go

Co-authored-by: a1012112796 <1012112796@qq.com>

* 修善wechatwork

* 修善wechatwork

* fix

* fix build

* fix

* fix build

* make webhooks.zh-cn.md

* delet unnecessary blank line

* delet unnecessary blank line

* 企业微信webhook

* 企业微信webhook

* 企业微信webhook

* 企业微信webhook

* 企业微信webhook

* fix

* fix

* 企业微信webhook

* 企业微信webhook

* 企业微信webhook

* fix wechat

* fix wechat

* fix wechat

* fix wechat

* Fix invalid params and typo of email templates (go-gitea#16394)

Signed-off-by: Meano <meanocat@gmail.com>

* Add LRU mem cache implementation (go-gitea#16226)

The current default memory cache implementation is unbounded in size and number of
objects cached. This is hardly ideal.

This PR proposes creating a TwoQueue LRU cache as the underlying cache for Gitea.
The cache is limited by the number of objects stored in the cache (rather than size)
for simplicity. The default number of objects is 50000 - which is perhaps too small
as most of our objects cached are going to be much less than 1kB.

It may be worth considering using a different LRU implementation that actively limits
sizes or avoids GC - however, this is just a beginning implementation.

Signed-off-by: Andrew Thornton <art27@cantab.net>

* [skip ci] Updated translations via Crowdin

* Replace `plugins/docker` with `techknowlogick/drone-docker`in ci (go-gitea#16407)

* plugins/docker -> techknowlogick/drone-docker

* It is multi-arch

* docs: rewrite email setup (go-gitea#16404)

* Add intro for both the docs page and mailer methods
  * Fix numbering level in SMTP section
  * Recommends implicit TLS

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>

* Validate Issue Index before querying DB (go-gitea#16406)

* Fix external renderer (go-gitea#16401)

* fix external renderer

* use GBackground context as fallback

* no fallback, return error

Co-authored-by: Lauris BH <lauris@nix.lv>

* Add checkbox to delete pull branch after successful merge (go-gitea#16049)

* Add checkbox to delete pull branch after successful merge

* Omit DeleteBranchAfterMerge field in json

* Log a warning instead of error when PR head branch deleted

* Add DefaultDeleteBranchAfterMerge to PullRequestConfig

* Add support for delete_branch_after_merge via API

* Fix for API: the branch should be deleted from the HEAD repo

If head and base repo are the same, reuse the already opened ctx.Repo.GitRepo

* Don't delegate to CleanupBranch, only reuse branch deletion code

CleanupBranch contains too much logic that has already been performed by the Merge

* Reuse gitrepo in MergePullRequest

Co-authored-by: Andrew Thornton <art27@cantab.net>

* [skip ci] Updated translations via Crowdin

* Detect encoding changes while parsing diff (go-gitea#16330)

* Detect encoding changes while parsing diff

* Let branch/tag name be a valid ref to get CI status (go-gitea#16400)

* fix go-gitea#16384#

* refactor: move shared helper func to utils package

* extend Tests

* use ctx.Repo.GitRepo if not nil

* fix

* fix

* 企业微信webhook

* 企业微信webhook

* 企业微信webhook

* fix build

* fix build

* Apply suggestions from code review

Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: myheavily <myheavily>
Co-authored-by: zhaoxin <gitea@fake.local>
Co-authored-by: Meano <Meano@foxmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: GiteaBot <teabot@gitea.io>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Bagas Sanjaya <bagasdotme@gmail.com>
Co-authored-by: Norwin <noerw@users.noreply.github.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Jimmy Praet <jimmy.praet@telenet.be>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.