From 5275bd2fe7b60ddb194c5e2152cc995f72fed35f Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 13 Jan 2020 16:26:46 +0100 Subject: [PATCH 1/9] Use Diff of PR 5252 --- models/webhook.go | 18 +- models/webhook_workwechat.go | 405 ++++++++++++++++++ modules/auth/repo_form.go | 12 + modules/convert/convert.go | 3 + modules/webhook/webhook.go | 5 + options/locale/locale_en-US.ini | 2 + public/img/workwechat.ico | Bin 0 -> 15086 bytes routers/repo/webhook.go | 94 +++- routers/routes/routes.go | 8 + templates/org/settings/hook_new.tmpl | 2 + templates/repo/settings/webhook/list.tmpl | 3 + templates/repo/settings/webhook/new.tmpl | 3 + .../repo/settings/webhook/workwechat.tmpl | 15 + 13 files changed, 562 insertions(+), 8 deletions(-) create mode 100644 models/webhook_workwechat.go create mode 100644 public/img/workwechat.ico create mode 100644 templates/repo/settings/webhook/workwechat.tmpl diff --git a/models/webhook.go b/models/webhook.go index 7eb17caaf666d..e78a98e28c9db 100644 --- a/models/webhook.go +++ b/models/webhook.go @@ -432,16 +432,18 @@ const ( DINGTALK TELEGRAM MSTEAMS + WORKWECHAT ) var hookTaskTypes = map[string]HookTaskType{ - "gitea": GITEA, - "gogs": GOGS, - "slack": SLACK, - "discord": DISCORD, - "dingtalk": DINGTALK, - "telegram": TELEGRAM, - "msteams": MSTEAMS, + "gitea": GITEA, + "gogs": GOGS, + "slack": SLACK, + "discord": DISCORD, + "dingtalk": DINGTALK, + "telegram": TELEGRAM, + "msteams": MSTEAMS, + "workwechat": WORKWECHAT, } // ToHookTaskType returns HookTaskType by given name. @@ -466,6 +468,8 @@ func (t HookTaskType) Name() string { return "telegram" case MSTEAMS: return "msteams" + case WORKWECHAT: + return "workwechat" } return "" } diff --git a/models/webhook_workwechat.go b/models/webhook_workwechat.go new file mode 100644 index 0000000000000..0f57338ca2069 --- /dev/null +++ b/models/webhook_workwechat.go @@ -0,0 +1,405 @@ +// Copyright 2018 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package models + +import ( + "encoding/json" + "errors" + "fmt" + "strings" + + "code.gitea.io/git" + api "code.gitea.io/sdk/gitea" +) + +type ( + // Text message + Text struct { + Content string `json:"content"` + } + + //TextCard message + TextCard struct { + Title string `json:"title"` + Description string `json:"description"` + URL string `json:"url"` + ButtonText string `json:"btntxt"` + } + //WorkwechatPayload represents + WorkwechatPayload struct { + ChatID string `json:"chatid"` + MsgType string `json:"msgtype"` + Text Text `json:"text"` + TextCard TextCard `json:"textcard"` + Safe int `json:"safe"` + } + + // WorkwechatMeta contains the work wechat metadata + WorkwechatMeta struct { + ChatID string `json:"chatid"` + } +) + +// SetSecret sets the workwechat secret +func (p *WorkwechatPayload) SetSecret(_ string) {} + +// JSONPayload Marshals the WorkwechatPayload to json +func (p *WorkwechatPayload) JSONPayload() ([]byte, error) { + data, err := json.MarshalIndent(p, "", " ") + if err != nil { + return []byte{}, err + } + return data, nil +} + +func getWorkwechatCreatePayload(p *api.CreatePayload, meta *WorkwechatMeta) (*WorkwechatPayload, error) { + // created tag/branch + refName := git.RefEndName(p.Ref) + title := fmt.Sprintf("[%s] %s %s created", p.Repo.FullName, p.RefType, refName) + + return &WorkwechatPayload{ + ChatID: meta.ChatID, + MsgType: "textcard", + TextCard: TextCard{ + Title: title, + Description: title, + ButtonText: fmt.Sprintf("view ref %s", refName), + URL: p.Repo.HTMLURL + "/src/" + refName, + }, + }, nil +} + +func getWorkwechatDeletePayload(p *api.DeletePayload, meta *WorkwechatMeta) (*WorkwechatPayload, error) { + // created tag/branch + refName := git.RefEndName(p.Ref) + title := fmt.Sprintf("[%s] %s %s deleted", p.Repo.FullName, p.RefType, refName) + + return &WorkwechatPayload{ + ChatID: meta.ChatID, + MsgType: "textcard", + TextCard: TextCard{ + Title: title, + Description: title, + ButtonText: fmt.Sprintf("view ref %s", refName), + URL: p.Repo.HTMLURL + "/src/" + refName, + }, + }, nil +} + +func getWorkwechatForkPayload(p *api.ForkPayload, meta *WorkwechatMeta) (*WorkwechatPayload, error) { + title := fmt.Sprintf("%s is forked to %s", p.Forkee.FullName, p.Repo.FullName) + + return &WorkwechatPayload{ + ChatID: meta.ChatID, + MsgType: "textcard", + TextCard: TextCard{ + Description: title, + Title: title, + ButtonText: fmt.Sprintf("view forked repo %s", p.Repo.FullName), + URL: p.Repo.HTMLURL, + }, + }, nil +} + +func getWorkwechatPushPayload(p *api.PushPayload, meta *WorkwechatMeta) (*WorkwechatPayload, error) { + var ( + branchName = git.RefEndName(p.Ref) + commitDesc string + ) + + var titleLink, linkText string + if len(p.Commits) == 1 { + commitDesc = "1 new commit" + titleLink = p.Commits[0].URL + linkText = fmt.Sprintf("view commit %s", p.Commits[0].ID[:7]) + } else { + commitDesc = fmt.Sprintf("%d new commits", len(p.Commits)) + titleLink = p.CompareURL + linkText = fmt.Sprintf("view commit %s...%s", p.Commits[0].ID[:7], p.Commits[len(p.Commits)-1].ID[:7]) + } + if titleLink == "" { + titleLink = p.Repo.HTMLURL + "/src/" + branchName + } + + title := fmt.Sprintf("[%s:%s] %s", p.Repo.FullName, branchName, commitDesc) + + var text string + // for each commit, generate attachment text + for i, commit := range p.Commits { + var authorName string + if commit.Author != nil { + authorName = " - " + commit.Author.Name + } + text += fmt.Sprintf("[%s](%s) %s", commit.ID[:7], commit.URL, + strings.TrimRight(commit.Message, "\r\n")) + authorName + // add linebreak to each commit but the last + if i < len(p.Commits)-1 { + text += "\n" + } + } + + return &WorkwechatPayload{ + ChatID: meta.ChatID, + MsgType: "textcard", + TextCard: TextCard{ + Description: text, + Title: title, + ButtonText: linkText, + URL: titleLink, + }, + }, nil +} + +func getWorkwechatIssuesPayload(p *api.IssuePayload, meta *WorkwechatMeta) (*WorkwechatPayload, error) { + var text, title string + switch p.Action { + case api.HookIssueOpened: + title = fmt.Sprintf("[%s] Issue opened: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) + text = p.Issue.Body + case api.HookIssueClosed: + title = fmt.Sprintf("[%s] Issue closed: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) + text = p.Issue.Body + case api.HookIssueReOpened: + title = fmt.Sprintf("[%s] Issue re-opened: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) + text = p.Issue.Body + case api.HookIssueEdited: + title = fmt.Sprintf("[%s] Issue edited: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) + text = p.Issue.Body + case api.HookIssueAssigned: + title = fmt.Sprintf("[%s] Issue assigned to %s: #%d %s", p.Repository.FullName, + p.Issue.Assignee.UserName, p.Index, p.Issue.Title) + text = p.Issue.Body + case api.HookIssueUnassigned: + title = fmt.Sprintf("[%s] Issue unassigned: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) + text = p.Issue.Body + case api.HookIssueLabelUpdated: + title = fmt.Sprintf("[%s] Issue labels updated: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) + text = p.Issue.Body + case api.HookIssueLabelCleared: + title = fmt.Sprintf("[%s] Issue labels cleared: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) + text = p.Issue.Body + case api.HookIssueSynchronized: + title = fmt.Sprintf("[%s] Issue synchronized: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) + text = p.Issue.Body + case api.HookIssueMilestoned: + title = fmt.Sprintf("[%s] Issue milestone: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) + text = p.Issue.Body + case api.HookIssueDemilestoned: + title = fmt.Sprintf("[%s] Issue clear milestone: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) + text = p.Issue.Body + } + + return &WorkwechatPayload{ + ChatID: meta.ChatID, + MsgType: "textcard", + TextCard: TextCard{ + Description: title + "\r\n\r\n" + text, + //Markdown: "# " + title + "\n" + text, + Title: title, + ButtonText: "view issue", + URL: p.Issue.URL, + }, + }, nil +} + +func getWorkwechatIssueCommentPayload(p *api.IssueCommentPayload, meta *WorkwechatMeta) (*WorkwechatPayload, error) { + title := fmt.Sprintf("#%d %s", p.Issue.Index, p.Issue.Title) + url := fmt.Sprintf("%s/issues/%d#%s", p.Repository.HTMLURL, p.Issue.Index, CommentHashTag(p.Comment.ID)) + var content string + switch p.Action { + case api.HookIssueCommentCreated: + title = "New comment: " + title + content = p.Comment.Body + case api.HookIssueCommentEdited: + title = "Comment edited: " + title + content = p.Comment.Body + case api.HookIssueCommentDeleted: + title = "Comment deleted: " + title + url = fmt.Sprintf("%s/issues/%d", p.Repository.HTMLURL, p.Issue.Index) + content = p.Comment.Body + } + + return &WorkwechatPayload{ + ChatID: meta.ChatID, + MsgType: "textcard", + TextCard: TextCard{ + Description: title + "\r\n\r\n" + content, + Title: title, + ButtonText: "view issue comment", + URL: url, + }, + }, nil +} + +func getWorkwechatPullRequestPayload(p *api.PullRequestPayload, meta *WorkwechatMeta) (*WorkwechatPayload, error) { + var text, title string + switch p.Action { + case api.HookIssueOpened: + title = fmt.Sprintf("[%s] Pull request opened: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) + text = p.PullRequest.Body + case api.HookIssueClosed: + if p.PullRequest.HasMerged { + title = fmt.Sprintf("[%s] Pull request merged: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) + } else { + title = fmt.Sprintf("[%s] Pull request closed: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) + } + text = p.PullRequest.Body + case api.HookIssueReOpened: + title = fmt.Sprintf("[%s] Pull request re-opened: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) + text = p.PullRequest.Body + case api.HookIssueEdited: + title = fmt.Sprintf("[%s] Pull request edited: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) + text = p.PullRequest.Body + case api.HookIssueAssigned: + list, err := MakeAssigneeList(&Issue{ID: p.PullRequest.ID}) + if err != nil { + return &WorkwechatPayload{}, err + } + title = fmt.Sprintf("[%s] Pull request assigned to %s: #%d %s", p.Repository.FullName, + list, p.Index, p.PullRequest.Title) + text = p.PullRequest.Body + case api.HookIssueUnassigned: + title = fmt.Sprintf("[%s] Pull request unassigned: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) + text = p.PullRequest.Body + case api.HookIssueLabelUpdated: + title = fmt.Sprintf("[%s] Pull request labels updated: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) + text = p.PullRequest.Body + case api.HookIssueLabelCleared: + title = fmt.Sprintf("[%s] Pull request labels cleared: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) + text = p.PullRequest.Body + case api.HookIssueSynchronized: + title = fmt.Sprintf("[%s] Pull request synchronized: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) + text = p.PullRequest.Body + case api.HookIssueMilestoned: + title = fmt.Sprintf("[%s] Pull request milestone: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) + text = p.PullRequest.Body + case api.HookIssueDemilestoned: + title = fmt.Sprintf("[%s] Pull request clear milestone: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) + text = p.PullRequest.Body + } + + return &WorkwechatPayload{ + ChatID: meta.ChatID, + MsgType: "textcard", + TextCard: TextCard{ + Description: title + "\r\n\r\n" + text, + //Markdown: "# " + title + "\n" + text, + Title: title, + ButtonText: "view pull request", + URL: p.PullRequest.HTMLURL, + }, + }, nil +} + +func getWorkwechatRepositoryPayload(p *api.RepositoryPayload, meta *WorkwechatMeta) (*WorkwechatPayload, error) { + var title, url string + switch p.Action { + case api.HookRepoCreated: + title = fmt.Sprintf("[%s] Repository created", p.Repository.FullName) + url = p.Repository.HTMLURL + return &WorkwechatPayload{ + ChatID: meta.ChatID, + MsgType: "textcard", + TextCard: TextCard{ + Description: title, + Title: title, + ButtonText: "view repository", + URL: url, + }, + }, nil + case api.HookRepoDeleted: + title = fmt.Sprintf("[%s] Repository deleted", p.Repository.FullName) + return &WorkwechatPayload{ + MsgType: "text", + Text: struct { + Content string `json:"content"` + }{ + Content: title, + }, + }, nil + } + + return nil, nil +} + +func getWorkwechatReleasePayload(p *api.ReleasePayload, meta *WorkwechatMeta) (*WorkwechatPayload, error) { + var title, url string + switch p.Action { + case api.HookReleasePublished: + title = fmt.Sprintf("[%s] Release created", p.Release.TagName) + url = p.Release.URL + return &WorkwechatPayload{ + ChatID: meta.ChatID, + MsgType: "textcard", + TextCard: TextCard{ + Description: title, + Title: title, + ButtonText: "view release", + URL: url, + }, + }, nil + case api.HookReleaseUpdated: + title = fmt.Sprintf("[%s] Release updated", p.Release.TagName) + url = p.Release.URL + return &WorkwechatPayload{ + ChatID: meta.ChatID, + MsgType: "textcard", + TextCard: TextCard{ + Description: title, + Title: title, + ButtonText: "view release", + URL: url, + }, + }, nil + + case api.HookReleaseDeleted: + title = fmt.Sprintf("[%s] Release deleted", p.Release.TagName) + url = p.Release.URL + return &WorkwechatPayload{ + ChatID: meta.ChatID, + MsgType: "textcard", + TextCard: TextCard{ + Description: title, + Title: title, + ButtonText: "view release", + URL: url, + }, + }, nil + } + + return nil, nil +} + +// GetWorkwechatPayload converts a work wechat webhook into a WorkwechatPayload +func GetWorkwechatPayload(p api.Payloader, event HookEventType, meta string) (*WorkwechatPayload, error) { + s := new(WorkwechatPayload) + + workwechatMeta := &WorkwechatMeta{} + if err := json.Unmarshal([]byte(meta), &workwechatMeta); err != nil { + return s, errors.New("GetWorkwechatPayload meta json:" + err.Error()) + } + switch event { + case HookEventCreate: + return getWorkwechatCreatePayload(p.(*api.CreatePayload), workwechatMeta) + case HookEventDelete: + return getWorkwechatDeletePayload(p.(*api.DeletePayload), workwechatMeta) + case HookEventFork: + return getWorkwechatForkPayload(p.(*api.ForkPayload), workwechatMeta) + case HookEventIssues: + return getWorkwechatIssuesPayload(p.(*api.IssuePayload), workwechatMeta) + case HookEventIssueComment: + return getWorkwechatIssueCommentPayload(p.(*api.IssueCommentPayload), workwechatMeta) + case HookEventPush: + return getWorkwechatPushPayload(p.(*api.PushPayload), workwechatMeta) + case HookEventPullRequest: + return getWorkwechatPullRequestPayload(p.(*api.PullRequestPayload), workwechatMeta) + case HookEventRepository: + return getWorkwechatRepositoryPayload(p.(*api.RepositoryPayload), workwechatMeta) + case HookEventRelease: + return getWorkwechatReleasePayload(p.(*api.ReleasePayload), workwechatMeta) + } + + return s, nil +} diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index 0086419b650f8..dffacc82e82f0 100644 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -312,6 +312,18 @@ func (f *NewMSTeamsHookForm) Validate(ctx *macaron.Context, errs binding.Errors) return validate(errs, ctx.Data, f, ctx.Locale) } +// NewWorkwechatHookForm form for creating work wechat hook +type NewWorkwechatHookForm struct { + PayloadURL string `binding:"Required;ValidUrl"` + ChatID string `form:"chatid"` + WebhookForm +} + +// Validate validates the fields +func (f *NewWorkwechatHookForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { + return validate(errs, ctx.Data, f, ctx.Locale) +} + // .___ // | | ______ ________ __ ____ // | |/ ___// ___/ | \_/ __ \ diff --git a/modules/convert/convert.go b/modules/convert/convert.go index a69b09a2b703c..18fcb726230a7 100644 --- a/modules/convert/convert.go +++ b/modules/convert/convert.go @@ -190,6 +190,9 @@ func ToHook(repoLink string, w *models.Webhook) *api.Hook { config["username"] = s.Username config["icon_url"] = s.IconURL config["color"] = s.Color + } else if w.HookTaskType == models.WORKWECHAT { + s := w.GetWorkwechatHook() + config["chatid"] = s.ChatID } return &api.Hook{ diff --git a/modules/webhook/webhook.go b/modules/webhook/webhook.go index 410e47461fe68..2dc50c992aedd 100644 --- a/modules/webhook/webhook.go +++ b/modules/webhook/webhook.go @@ -114,6 +114,11 @@ func prepareWebhook(w *models.Webhook, repo *models.Repository, event models.Hoo if err != nil { return fmt.Errorf("GetMSTeamsPayload: %v", err) } + case WORKWECHAT: + payloader, err = GetWorkwechatPayload(p, event, w.Meta) + if err != nil { + return fmt.Errorf("GetWorkwechatPayload: %v", err) + } default: p.SetSecret(w.Secret) payloader = p diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 4dc0b92234c35..88738432d6814 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1368,6 +1368,8 @@ settings.add_discord_hook_desc = Integrate Discord into your re settings.add_dingtalk_hook_desc = Integrate Dingtalk into your repository. settings.add_telegram_hook_desc = Integrate Telegram into your repository. settings.add_msteams_hook_desc = Integrate Microsoft Teams into your repository. +settings.add_workwechat_hook_desc = Integrate Work Wechat into your repository. +settings.workwechat_chatid=Chat ID settings.deploy_keys = Deploy Keys settings.add_deploy_key = Add Deploy Key settings.deploy_key_desc = Deploy keys have read-only pull access to the repository. diff --git a/public/img/workwechat.ico b/public/img/workwechat.ico new file mode 100644 index 0000000000000000000000000000000000000000..a7f24f5aaad28fafa74ccd393607fba47704c5e8 GIT binary patch literal 15086 zcmeHOdvKK16+a=xw6!+Smsl!^Rw)(|Kx%6r&Z5(yRjajD`_Rr5OA^A+B6JF+zOuRNXr91;*01`&P|K=Tw*Hc(Nr34M~F}fLTTim=Mub>Sjs}JR2t&AFf;T> zO1X1^VI>c@{BGhe4R;I{Ucg5;1bws&^!^jobm?IAq$O7}Fh9=ksvc$G18K<{Ou#+6 zvx-;+)Zt{XihjutQ@+8Pon+a-9!LD8p`T@HfS;jU;0`M6It^6OVT2N98kVWvr2Hj3 z1=ulOqgFmhE!>OnI_=;~@y+Q1{_Sq_)v+qN3wk0-zr^8}qrpnLJEmKUh`$tX zjQZ$=t|OMOjd7>EKs80j-ySXm<}da51^DxF%IohhE*GyhX!)`)-F)oU&Z-HUf_coj|LMf7o#KUhOII$=kh z_MNDsPnrCuo!-Tlqdkt;eQI}7eNDxWQA1G#p_evIaa_MhKSuws=DN5#_{iT=N1sfp z`*aIr{%zxCs}5~EF{V!Pn zNPgQUjt16kz#Ou03w8;civH*Z0)6D=1pHN0=O&Z&GU*$eiu&VlM|~eAo-#a{Jc+{CO%A7`ulJ z|G$w+W=PAMt{G38C(NLRFI=3C9r*vGf&ayHPY?a4^0j52Uh%x%V%oTsrNRN^hp+@Z%jO4y322(t|cy zk|2jYN-DW*mp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=-gd)DgP2In~W6515aNKeDoS(Ll<&41RwAHvbG?%Y9%E?8tep z*n1gyD-gdU)4r;iIIGd-Rw3=|}(Pz}i3Pjf*jRm-Joqn?2Z9d`;$ip?JGl6yqxm z@5BEn9I9VfvKDX2Ov6ua8yZRpi*e$c= zh5icTbOFj|$lVgw%kNox7wx?x_^q`Wc)luoV7vbZF*XzT6xXiOC|2OOhoc0lrf8N%y#w {{else if eq .HookType "msteams"}} + {{else if eq .HookType "workwechat"}} + {{end}} diff --git a/templates/repo/settings/webhook/list.tmpl b/templates/repo/settings/webhook/list.tmpl index d1784564dc5b0..20c41d8133684 100644 --- a/templates/repo/settings/webhook/list.tmpl +++ b/templates/repo/settings/webhook/list.tmpl @@ -26,6 +26,9 @@ Microsoft Teams + + Work Wechat + diff --git a/templates/repo/settings/webhook/new.tmpl b/templates/repo/settings/webhook/new.tmpl index 1d5d849738e9d..911de794aba41 100644 --- a/templates/repo/settings/webhook/new.tmpl +++ b/templates/repo/settings/webhook/new.tmpl @@ -21,6 +21,8 @@ {{else if eq .HookType "msteams"}} + {{else if eq .HookType "workwechat"}} + {{end}} @@ -32,6 +34,7 @@ {{template "repo/settings/webhook/dingtalk" .}} {{template "repo/settings/webhook/telegram" .}} {{template "repo/settings/webhook/msteams" .}} + {{template "repo/settings/webhook/workwechat" .}} {{template "repo/settings/webhook/history" .}} diff --git a/templates/repo/settings/webhook/workwechat.tmpl b/templates/repo/settings/webhook/workwechat.tmpl new file mode 100644 index 0000000000000..fa1012efc29e6 --- /dev/null +++ b/templates/repo/settings/webhook/workwechat.tmpl @@ -0,0 +1,15 @@ +{{if eq .HookType "workwechat"}} +

{{.i18n.Tr "repo.settings.add_workwechat_hook_desc" "https://work.weixin.qq.com" | Str2html}}

+
+ {{.CsrfTokenHtml}} +
+ + +
+
+ + +
+ {{template "repo/settings/webhook/settings" .}} +
+{{end}} From 2c9193a55d42c1c95f75379fe80c5b798ea4dc94 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 13 Jan 2020 16:27:36 +0100 Subject: [PATCH 2/9] move --- models/webhook_workwechat.go => modules/webhook/workwechat.go | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename models/webhook_workwechat.go => modules/webhook/workwechat.go (100%) diff --git a/models/webhook_workwechat.go b/modules/webhook/workwechat.go similarity index 100% rename from models/webhook_workwechat.go rename to modules/webhook/workwechat.go From a39cf7ddf2a83016365f870137f979f62e345b0e Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 13 Jan 2020 16:41:55 +0100 Subject: [PATCH 3/9] apply changes of 9422 --- modules/webhook/workwechat.go | 179 +++++----------------------------- 1 file changed, 25 insertions(+), 154 deletions(-) diff --git a/modules/webhook/workwechat.go b/modules/webhook/workwechat.go index 0f57338ca2069..01abdaf871d2d 100644 --- a/modules/webhook/workwechat.go +++ b/modules/webhook/workwechat.go @@ -153,142 +153,46 @@ func getWorkwechatPushPayload(p *api.PushPayload, meta *WorkwechatMeta) (*Workwe } func getWorkwechatIssuesPayload(p *api.IssuePayload, meta *WorkwechatMeta) (*WorkwechatPayload, error) { - var text, title string - switch p.Action { - case api.HookIssueOpened: - title = fmt.Sprintf("[%s] Issue opened: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) - text = p.Issue.Body - case api.HookIssueClosed: - title = fmt.Sprintf("[%s] Issue closed: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) - text = p.Issue.Body - case api.HookIssueReOpened: - title = fmt.Sprintf("[%s] Issue re-opened: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) - text = p.Issue.Body - case api.HookIssueEdited: - title = fmt.Sprintf("[%s] Issue edited: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) - text = p.Issue.Body - case api.HookIssueAssigned: - title = fmt.Sprintf("[%s] Issue assigned to %s: #%d %s", p.Repository.FullName, - p.Issue.Assignee.UserName, p.Index, p.Issue.Title) - text = p.Issue.Body - case api.HookIssueUnassigned: - title = fmt.Sprintf("[%s] Issue unassigned: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) - text = p.Issue.Body - case api.HookIssueLabelUpdated: - title = fmt.Sprintf("[%s] Issue labels updated: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) - text = p.Issue.Body - case api.HookIssueLabelCleared: - title = fmt.Sprintf("[%s] Issue labels cleared: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) - text = p.Issue.Body - case api.HookIssueSynchronized: - title = fmt.Sprintf("[%s] Issue synchronized: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) - text = p.Issue.Body - case api.HookIssueMilestoned: - title = fmt.Sprintf("[%s] Issue milestone: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) - text = p.Issue.Body - case api.HookIssueDemilestoned: - title = fmt.Sprintf("[%s] Issue clear milestone: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title) - text = p.Issue.Body - } + text, issueTitle, attachmentText, _ := getIssuesPayloadInfo(p, noneLinkFormatter) return &WorkwechatPayload{ ChatID: meta.ChatID, MsgType: "textcard", TextCard: TextCard{ - Description: title + "\r\n\r\n" + text, - //Markdown: "# " + title + "\n" + text, - Title: title, - ButtonText: "view issue", - URL: p.Issue.URL, + Description: title + "\r\n\r\n" + attachmentText, + Title: issueTitle, + ButtonText: "view issue", + URL: p.Issue.URL, }, }, nil } func getWorkwechatIssueCommentPayload(p *api.IssueCommentPayload, meta *WorkwechatMeta) (*WorkwechatPayload, error) { - title := fmt.Sprintf("#%d %s", p.Issue.Index, p.Issue.Title) - url := fmt.Sprintf("%s/issues/%d#%s", p.Repository.HTMLURL, p.Issue.Index, CommentHashTag(p.Comment.ID)) - var content string - switch p.Action { - case api.HookIssueCommentCreated: - title = "New comment: " + title - content = p.Comment.Body - case api.HookIssueCommentEdited: - title = "Comment edited: " + title - content = p.Comment.Body - case api.HookIssueCommentDeleted: - title = "Comment deleted: " + title - url = fmt.Sprintf("%s/issues/%d", p.Repository.HTMLURL, p.Issue.Index) - content = p.Comment.Body - } + text, issueTitle, _ := getIssueCommentPayloadInfo(p, noneLinkFormatter) return &WorkwechatPayload{ ChatID: meta.ChatID, MsgType: "textcard", TextCard: TextCard{ - Description: title + "\r\n\r\n" + content, - Title: title, + Description: text + "\r\n\r\n" + p.Comment.Body, + Title: issueTitle, ButtonText: "view issue comment", - URL: url, + URL: p.Comment.HTMLURL, }, }, nil } func getWorkwechatPullRequestPayload(p *api.PullRequestPayload, meta *WorkwechatMeta) (*WorkwechatPayload, error) { - var text, title string - switch p.Action { - case api.HookIssueOpened: - title = fmt.Sprintf("[%s] Pull request opened: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) - text = p.PullRequest.Body - case api.HookIssueClosed: - if p.PullRequest.HasMerged { - title = fmt.Sprintf("[%s] Pull request merged: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) - } else { - title = fmt.Sprintf("[%s] Pull request closed: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) - } - text = p.PullRequest.Body - case api.HookIssueReOpened: - title = fmt.Sprintf("[%s] Pull request re-opened: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) - text = p.PullRequest.Body - case api.HookIssueEdited: - title = fmt.Sprintf("[%s] Pull request edited: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) - text = p.PullRequest.Body - case api.HookIssueAssigned: - list, err := MakeAssigneeList(&Issue{ID: p.PullRequest.ID}) - if err != nil { - return &WorkwechatPayload{}, err - } - title = fmt.Sprintf("[%s] Pull request assigned to %s: #%d %s", p.Repository.FullName, - list, p.Index, p.PullRequest.Title) - text = p.PullRequest.Body - case api.HookIssueUnassigned: - title = fmt.Sprintf("[%s] Pull request unassigned: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) - text = p.PullRequest.Body - case api.HookIssueLabelUpdated: - title = fmt.Sprintf("[%s] Pull request labels updated: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) - text = p.PullRequest.Body - case api.HookIssueLabelCleared: - title = fmt.Sprintf("[%s] Pull request labels cleared: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) - text = p.PullRequest.Body - case api.HookIssueSynchronized: - title = fmt.Sprintf("[%s] Pull request synchronized: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) - text = p.PullRequest.Body - case api.HookIssueMilestoned: - title = fmt.Sprintf("[%s] Pull request milestone: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) - text = p.PullRequest.Body - case api.HookIssueDemilestoned: - title = fmt.Sprintf("[%s] Pull request clear milestone: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title) - text = p.PullRequest.Body - } + text, issueTitle, attachmentText, _ := getPullRequestPayloadInfo(p, noneLinkFormatter) return &WorkwechatPayload{ ChatID: meta.ChatID, MsgType: "textcard", TextCard: TextCard{ - Description: title + "\r\n\r\n" + text, - //Markdown: "# " + title + "\n" + text, - Title: title, - ButtonText: "view pull request", - URL: p.PullRequest.HTMLURL, + Description: text + "\r\n\r\n" + attachmentText, + Title: issueTitle, + ButtonText: "view pull request", + URL: p.PullRequest.HTMLURL, }, }, nil } @@ -325,51 +229,18 @@ func getWorkwechatRepositoryPayload(p *api.RepositoryPayload, meta *WorkwechatMe } func getWorkwechatReleasePayload(p *api.ReleasePayload, meta *WorkwechatMeta) (*WorkwechatPayload, error) { - var title, url string - switch p.Action { - case api.HookReleasePublished: - title = fmt.Sprintf("[%s] Release created", p.Release.TagName) - url = p.Release.URL - return &WorkwechatPayload{ - ChatID: meta.ChatID, - MsgType: "textcard", - TextCard: TextCard{ - Description: title, - Title: title, - ButtonText: "view release", - URL: url, - }, - }, nil - case api.HookReleaseUpdated: - title = fmt.Sprintf("[%s] Release updated", p.Release.TagName) - url = p.Release.URL - return &WorkwechatPayload{ - ChatID: meta.ChatID, - MsgType: "textcard", - TextCard: TextCard{ - Description: title, - Title: title, - ButtonText: "view release", - URL: url, - }, - }, nil - - case api.HookReleaseDeleted: - title = fmt.Sprintf("[%s] Release deleted", p.Release.TagName) - url = p.Release.URL - return &WorkwechatPayload{ - ChatID: meta.ChatID, - MsgType: "textcard", - TextCard: TextCard{ - Description: title, - Title: title, - ButtonText: "view release", - URL: url, - }, - }, nil - } + text, _ := getReleasePayloadInfo(p, noneLinkFormatter) - return nil, nil + return &WorkwechatPayload{ + ChatID: meta.ChatID, + MsgType: "textcard", + TextCard: TextCard{ + Description: text, + Title: text, + ButtonText: "view release", + URL: p.Release.URL, + }, + }, nil } // GetWorkwechatPayload converts a work wechat webhook into a WorkwechatPayload From 7eee88ae058d4f9071facb13ff51087f1d2544fb Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 13 Jan 2020 16:44:28 +0100 Subject: [PATCH 4/9] fix package --- modules/webhook/workwechat.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/webhook/workwechat.go b/modules/webhook/workwechat.go index 01abdaf871d2d..c86a804827457 100644 --- a/modules/webhook/workwechat.go +++ b/modules/webhook/workwechat.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. -package models +package webhook import ( "encoding/json" From ebbcac6f760d2ccfd41695ae075f989b5fd31c2f Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 13 Jan 2020 16:56:40 +0100 Subject: [PATCH 5/9] apply changes of 9601 --- modules/webhook/workwechat.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/webhook/workwechat.go b/modules/webhook/workwechat.go index c86a804827457..9e3dadcbb6773 100644 --- a/modules/webhook/workwechat.go +++ b/modules/webhook/workwechat.go @@ -153,13 +153,13 @@ func getWorkwechatPushPayload(p *api.PushPayload, meta *WorkwechatMeta) (*Workwe } func getWorkwechatIssuesPayload(p *api.IssuePayload, meta *WorkwechatMeta) (*WorkwechatPayload, error) { - text, issueTitle, attachmentText, _ := getIssuesPayloadInfo(p, noneLinkFormatter) + text, issueTitle, attachmentText, _ := getIssuesPayloadInfo(p, noneLinkFormatter, true) return &WorkwechatPayload{ ChatID: meta.ChatID, MsgType: "textcard", TextCard: TextCard{ - Description: title + "\r\n\r\n" + attachmentText, + Description: text + "\r\n\r\n" + attachmentText, Title: issueTitle, ButtonText: "view issue", URL: p.Issue.URL, @@ -168,7 +168,7 @@ func getWorkwechatIssuesPayload(p *api.IssuePayload, meta *WorkwechatMeta) (*Wor } func getWorkwechatIssueCommentPayload(p *api.IssueCommentPayload, meta *WorkwechatMeta) (*WorkwechatPayload, error) { - text, issueTitle, _ := getIssueCommentPayloadInfo(p, noneLinkFormatter) + text, issueTitle, _ := getIssueCommentPayloadInfo(p, noneLinkFormatter, true) return &WorkwechatPayload{ ChatID: meta.ChatID, @@ -183,7 +183,7 @@ func getWorkwechatIssueCommentPayload(p *api.IssueCommentPayload, meta *Workwech } func getWorkwechatPullRequestPayload(p *api.PullRequestPayload, meta *WorkwechatMeta) (*WorkwechatPayload, error) { - text, issueTitle, attachmentText, _ := getPullRequestPayloadInfo(p, noneLinkFormatter) + text, issueTitle, attachmentText, _ := getPullRequestPayloadInfo(p, noneLinkFormatter, true) return &WorkwechatPayload{ ChatID: meta.ChatID, @@ -229,7 +229,7 @@ func getWorkwechatRepositoryPayload(p *api.RepositoryPayload, meta *WorkwechatMe } func getWorkwechatReleasePayload(p *api.ReleasePayload, meta *WorkwechatMeta) (*WorkwechatPayload, error) { - text, _ := getReleasePayloadInfo(p, noneLinkFormatter) + text, _ := getReleasePayloadInfo(p, noneLinkFormatter, true) return &WorkwechatPayload{ ChatID: meta.ChatID, @@ -244,7 +244,7 @@ func getWorkwechatReleasePayload(p *api.ReleasePayload, meta *WorkwechatMeta) (* } // GetWorkwechatPayload converts a work wechat webhook into a WorkwechatPayload -func GetWorkwechatPayload(p api.Payloader, event HookEventType, meta string) (*WorkwechatPayload, error) { +func GetWorkwechatPayload(p api.Payloader, event models.HookEventType, meta string) (*WorkwechatPayload, error) { s := new(WorkwechatPayload) workwechatMeta := &WorkwechatMeta{} From 18befa3edafbc5ed866a5a90a0c6741d673546c0 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 13 Jan 2020 17:05:31 +0100 Subject: [PATCH 6/9] fix after code refator .... --- modules/convert/convert.go | 4 ++-- modules/webhook/webhook.go | 2 +- modules/webhook/workwechat.go | 33 ++++++++++++++++++++++----------- routers/repo/webhook.go | 4 ++-- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/modules/convert/convert.go b/modules/convert/convert.go index 18fcb726230a7..ff0db789a0b1a 100644 --- a/modules/convert/convert.go +++ b/modules/convert/convert.go @@ -191,8 +191,8 @@ func ToHook(repoLink string, w *models.Webhook) *api.Hook { config["icon_url"] = s.IconURL config["color"] = s.Color } else if w.HookTaskType == models.WORKWECHAT { - s := w.GetWorkwechatHook() - config["chatid"] = s.ChatID + we := webhook.GetWorkwechatHook(w) + config["chatid"] = we.ChatID } return &api.Hook{ diff --git a/modules/webhook/webhook.go b/modules/webhook/webhook.go index 2dc50c992aedd..f531b8be769e6 100644 --- a/modules/webhook/webhook.go +++ b/modules/webhook/webhook.go @@ -114,7 +114,7 @@ func prepareWebhook(w *models.Webhook, repo *models.Repository, event models.Hoo if err != nil { return fmt.Errorf("GetMSTeamsPayload: %v", err) } - case WORKWECHAT: + case models.WORKWECHAT: payloader, err = GetWorkwechatPayload(p, event, w.Meta) if err != nil { return fmt.Errorf("GetWorkwechatPayload: %v", err) diff --git a/modules/webhook/workwechat.go b/modules/webhook/workwechat.go index 9e3dadcbb6773..83a6322f6a925 100644 --- a/modules/webhook/workwechat.go +++ b/modules/webhook/workwechat.go @@ -10,8 +10,10 @@ import ( "fmt" "strings" - "code.gitea.io/git" - api "code.gitea.io/sdk/gitea" + "code.gitea.io/gitea/models" + "code.gitea.io/gitea/modules/git" + "code.gitea.io/gitea/modules/log" + api "code.gitea.io/gitea/modules/structs" ) type ( @@ -42,6 +44,15 @@ type ( } ) +// GetWorkwechatHook returns workwechat metadata +func GetWorkwechatHook(w *models.Webhook) *WorkwechatMeta { + we := &WorkwechatMeta{} + if err := json.Unmarshal([]byte(w.Meta), we); err != nil { + log.Error("webhook.GetWorkwechatHook(%d): %v", w.ID, err) + } + return we +} + // SetSecret sets the workwechat secret func (p *WorkwechatPayload) SetSecret(_ string) {} @@ -252,23 +263,23 @@ func GetWorkwechatPayload(p api.Payloader, event models.HookEventType, meta stri return s, errors.New("GetWorkwechatPayload meta json:" + err.Error()) } switch event { - case HookEventCreate: + case models.HookEventCreate: return getWorkwechatCreatePayload(p.(*api.CreatePayload), workwechatMeta) - case HookEventDelete: + case models.HookEventDelete: return getWorkwechatDeletePayload(p.(*api.DeletePayload), workwechatMeta) - case HookEventFork: + case models.HookEventFork: return getWorkwechatForkPayload(p.(*api.ForkPayload), workwechatMeta) - case HookEventIssues: + case models.HookEventIssues: return getWorkwechatIssuesPayload(p.(*api.IssuePayload), workwechatMeta) - case HookEventIssueComment: + case models.HookEventIssueComment: return getWorkwechatIssueCommentPayload(p.(*api.IssueCommentPayload), workwechatMeta) - case HookEventPush: + case models.HookEventPush: return getWorkwechatPushPayload(p.(*api.PushPayload), workwechatMeta) - case HookEventPullRequest: + case models.HookEventPullRequest: return getWorkwechatPullRequestPayload(p.(*api.PullRequestPayload), workwechatMeta) - case HookEventRepository: + case models.HookEventRepository: return getWorkwechatRepositoryPayload(p.(*api.RepositoryPayload), workwechatMeta) - case HookEventRelease: + case models.HookEventRelease: return getWorkwechatReleasePayload(p.(*api.ReleasePayload), workwechatMeta) } diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go index 113ec489fb1ad..f2ae12486594b 100644 --- a/routers/repo/webhook.go +++ b/routers/repo/webhook.go @@ -506,7 +506,7 @@ func WorkwechatHooksNewPost(ctx *context.Context, form auth.NewWorkwechatHookFor ctx.HTML(200, orCtx.NewTemplate) return } - meta, err := json.Marshal(&models.WorkwechatMeta{ + meta, err := json.Marshal(&webhook.WorkwechatMeta{ ChatID: form.ChatID, }) if err != nil { @@ -887,7 +887,7 @@ func WorkwechatHooksEditPost(ctx *context.Context, form auth.NewWorkwechatHookFo ctx.HTML(200, orCtx.NewTemplate) return } - meta, err := json.Marshal(&models.WorkwechatMeta{ + meta, err := json.Marshal(&webhook.WorkwechatMeta{ ChatID: form.ChatID, }) if err != nil { From 1ce8ab13f81ca367fead1adad6321b90c5488085 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 13 Jan 2020 17:42:27 +0100 Subject: [PATCH 7/9] fix paths --- templates/repo/settings/webhook/list.tmpl | 2 +- templates/repo/settings/webhook/workwechat.tmpl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/repo/settings/webhook/list.tmpl b/templates/repo/settings/webhook/list.tmpl index 20c41d8133684..1cd713286d456 100644 --- a/templates/repo/settings/webhook/list.tmpl +++ b/templates/repo/settings/webhook/list.tmpl @@ -26,7 +26,7 @@ Microsoft Teams - + Work Wechat diff --git a/templates/repo/settings/webhook/workwechat.tmpl b/templates/repo/settings/webhook/workwechat.tmpl index fa1012efc29e6..fb35cb82cc1f5 100644 --- a/templates/repo/settings/webhook/workwechat.tmpl +++ b/templates/repo/settings/webhook/workwechat.tmpl @@ -1,10 +1,10 @@ {{if eq .HookType "workwechat"}}

{{.i18n.Tr "repo.settings.add_workwechat_hook_desc" "https://work.weixin.qq.com" | Str2html}}

-
+ {{.CsrfTokenHtml}}
- +
From c908df7caf7ac31014895375b8480facfdd72bb8 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 23 Sep 2020 12:13:59 +0200 Subject: [PATCH 8/9] ICO to PNG --- public/img/workwechat.ico | Bin 15086 -> 0 bytes public/img/workwechat.png | Bin 0 -> 2201 bytes templates/org/settings/hook_new.tmpl | 2 +- templates/repo/settings/webhook/list.tmpl | 2 +- templates/repo/settings/webhook/new.tmpl | 2 +- 5 files changed, 3 insertions(+), 3 deletions(-) delete mode 100644 public/img/workwechat.ico create mode 100644 public/img/workwechat.png diff --git a/public/img/workwechat.ico b/public/img/workwechat.ico deleted file mode 100644 index a7f24f5aaad28fafa74ccd393607fba47704c5e8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15086 zcmeHOdvKK16+a=xw6!+Smsl!^Rw)(|Kx%6r&Z5(yRjajD`_Rr5OA^A+B6JF+zOuRNXr91;*01`&P|K=Tw*Hc(Nr34M~F}fLTTim=Mub>Sjs}JR2t&AFf;T> zO1X1^VI>c@{BGhe4R;I{Ucg5;1bws&^!^jobm?IAq$O7}Fh9=ksvc$G18K<{Ou#+6 zvx-;+)Zt{XihjutQ@+8Pon+a-9!LD8p`T@HfS;jU;0`M6It^6OVT2N98kVWvr2Hj3 z1=ulOqgFmhE!>OnI_=;~@y+Q1{_Sq_)v+qN3wk0-zr^8}qrpnLJEmKUh`$tX zjQZ$=t|OMOjd7>EKs80j-ySXm<}da51^DxF%IohhE*GyhX!)`)-F)oU&Z-HUf_coj|LMf7o#KUhOII$=kh z_MNDsPnrCuo!-Tlqdkt;eQI}7eNDxWQA1G#p_evIaa_MhKSuws=DN5#_{iT=N1sfp z`*aIr{%zxCs}5~EF{V!Pn zNPgQUjt16kz#Ou03w8;civH*Z0)6D=1pHN0=O&Z&GU*$eiu&VlM|~eAo-#a{Jc+{CO%A7`ulJ z|G$w+W=PAMt{G38C(NLRFI=3C9r*vGf&ayHPY?a4^0j52Uh%x%V%oTsrNRN^hp+@Z%jO4y322(t|cy zk|2jYN-DW*mpl1U_I#=AppC9I@uN;VQpshr9OrwZ;s3CKg1 zHh8e#Ty5G1rnJv);qN+A9{%_bFQX4+1D~4?>_e}C{Q=W{I(fB&Ji+InuH(vK8-%J&&d{izaoiP%Ixkc8V{Y_j(V%;4d|YlQi%(LtP7!I z9)fj_VA?^wwx6z_thpQKuBL94hK*-CYv_78+i`&!S7e>3${y86yOf>;n#H}gbrxZq zA)5Bk{`=+p2=m9?vWK(I*??NU*`4(?LiP|SpAF1UCi8bpC+d~$a{}wT=A$Dq8^#{Z z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`(?t z)SQ7ULKF2EuEk=UjOVYX{p0Jo$5j@p@=*j0gt+OgYuJ#!q^xnK;Tj(WD(_Haf2P0X zh3;Y$U2F#~0QSfP|EAgHn^~=f`M^nA`EcWPI2nricrEBs-whUID$8OA&I$B>q8wv3 z0p_EOMiGRQoX88m9r7_dY|&LhRU)P zeFopeqqr;r0x7}ynpE(ctP|9>f09Jk79i4H;_5akW1q58KpKX~EReVlfg@+0*Jy}Z zXEb#h$dcqjo!a^qpT}^Y2RwA-1RfyKwH{8jVpIiX3RTV%lBVtPE~-O&%iYiwTpZrR zzW8@gSqWMObRg^ms{t_wQ5;l4Sd?KHiEt$sMz7Y1@(T>N`K?Oa(LbtV`ici7wAFPdaF%HO(2gI;ZHjSxZsZ z8*D?n<@?$_Jy9*eHCs^~m*?%e_Y}=4AhiSCEET+x+eGGOpOjWK_@I}-<31lQl;S)) z&Zoy!0LUdAAjlUGnt@K>Zx|*e=hB*(%Ql@(`n|O3*sNZ1UqnG#F!FUCh`i_pRns;U zH}P&i37jOAQ9E5@%*TedTK>`d8vXLS&%P+wjlN|SyA%ufl{OH92OhlQE#SlAow&R`$nLU)z}(B?ha0B z3Lb$&!L1-kyFSZZt beP;gyR&iVOdp++Q00000NkvXXu0mjfP<0Qu literal 0 HcmV?d00001 diff --git a/templates/org/settings/hook_new.tmpl b/templates/org/settings/hook_new.tmpl index 83931dfa0b4ba..dc9d170c60295 100644 --- a/templates/org/settings/hook_new.tmpl +++ b/templates/org/settings/hook_new.tmpl @@ -28,7 +28,7 @@ {{else if eq .HookType "matrix"}} {{else if eq .HookType "workwechat"}} - + {{end}}
diff --git a/templates/repo/settings/webhook/list.tmpl b/templates/repo/settings/webhook/list.tmpl index 78e38a4c981c4..b7796a9332eb0 100644 --- a/templates/repo/settings/webhook/list.tmpl +++ b/templates/repo/settings/webhook/list.tmpl @@ -34,7 +34,7 @@ - Work Wechat + Work Wechat diff --git a/templates/repo/settings/webhook/new.tmpl b/templates/repo/settings/webhook/new.tmpl index be5a94d7b0cd0..dfd414a9e2fcc 100644 --- a/templates/repo/settings/webhook/new.tmpl +++ b/templates/repo/settings/webhook/new.tmpl @@ -26,7 +26,7 @@ {{else if eq .HookType "matrix"}} {{else if eq .HookType "workwechat"}} - + {{end}} From 51fca2c79758ac786186f26fb28fa011442ae96c Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 23 Sep 2020 12:14:57 +0200 Subject: [PATCH 9/9] format --- templates/repo/settings/webhook/list.tmpl | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/repo/settings/webhook/list.tmpl b/templates/repo/settings/webhook/list.tmpl index b7796a9332eb0..b880e719a6747 100644 --- a/templates/repo/settings/webhook/list.tmpl +++ b/templates/repo/settings/webhook/list.tmpl @@ -31,7 +31,6 @@ Matrix - Work Wechat