diff --git a/.deadcode-out b/.deadcode-out index c63fd9e0af..1b65e3203d 100644 --- a/.deadcode-out +++ b/.deadcode-out @@ -341,5 +341,4 @@ package "code.gitea.io/gitea/services/repository/files" package "code.gitea.io/gitea/services/webhook" func NewNotifier - func List diff --git a/options/locale/locale_bg.ini b/options/locale/locale_bg.ini index 5b9bb0715e..6b482d3f2a 100644 --- a/options/locale/locale_bg.ini +++ b/options/locale/locale_bg.ini @@ -928,9 +928,9 @@ settings.web_hook_name_discord = Discord settings.web_hook_name_telegram = Telegram settings.web_hook_name_matrix = Matrix settings.web_hook_name_gogs = Gogs -settings.web_hook_name_feishu_or_larksuite = Feishu / Lark Suite -settings.web_hook_name_feishu = Feishu -settings.web_hook_name_larksuite = Lark Suite +settings.web_hook_name_feishu = Feishu / Lark Suite +settings.web_hook_name_feishu_only = Feishu +settings.web_hook_name_larksuite_only = Lark Suite settings.web_hook_name_wechatwork = WeCom (Wechat Work) settings.web_hook_name_packagist = Packagist diff.file_byte_size = Размер diff --git a/options/locale/locale_cs-CZ.ini b/options/locale/locale_cs-CZ.ini index 3747ae28c9..86e7f54d80 100644 --- a/options/locale/locale_cs-CZ.ini +++ b/options/locale/locale_cs-CZ.ini @@ -2306,9 +2306,9 @@ settings.web_hook_name_dingtalk=DingTalk settings.web_hook_name_telegram=Telegram settings.web_hook_name_matrix=Matrix settings.web_hook_name_msteams=Microsoft Teams -settings.web_hook_name_feishu_or_larksuite=Feishu / Lark Suite -settings.web_hook_name_feishu=Feishu -settings.web_hook_name_larksuite=Lark Suite +settings.web_hook_name_feishu=Feishu / Lark Suite +settings.web_hook_name_feishu_only =Feishu +settings.web_hook_name_larksuite_only =Lark Suite settings.web_hook_name_wechatwork=WeCom (Wechat Work) settings.web_hook_name_packagist=Packagist settings.packagist_username=Uživatelské jméno pro Packagist diff --git a/options/locale/locale_de-DE.ini b/options/locale/locale_de-DE.ini index f5aafdf5c9..9792692a75 100644 --- a/options/locale/locale_de-DE.ini +++ b/options/locale/locale_de-DE.ini @@ -2302,9 +2302,9 @@ settings.web_hook_name_dingtalk=DingTalk settings.web_hook_name_telegram=Telegram settings.web_hook_name_matrix=Matrix settings.web_hook_name_msteams=Microsoft Teams -settings.web_hook_name_feishu_or_larksuite=Feishu / Lark Suite -settings.web_hook_name_feishu=Feishu -settings.web_hook_name_larksuite=Lark Suite +settings.web_hook_name_feishu=Feishu / Lark Suite +settings.web_hook_name_feishu_only =Feishu +settings.web_hook_name_larksuite_only =Lark Suite settings.web_hook_name_wechatwork=WeCom (Wechat Work) settings.web_hook_name_packagist=Packagist settings.packagist_username=Benutzername für Packagist diff --git a/options/locale/locale_el-GR.ini b/options/locale/locale_el-GR.ini index 36b7518c62..b9d2881d8a 100644 --- a/options/locale/locale_el-GR.ini +++ b/options/locale/locale_el-GR.ini @@ -2293,9 +2293,9 @@ settings.web_hook_name_dingtalk=DingTalk settings.web_hook_name_telegram=Telegram settings.web_hook_name_matrix=Matrix settings.web_hook_name_msteams=Microsoft Teams -settings.web_hook_name_feishu_or_larksuite=Feishu / Lark Suite -settings.web_hook_name_feishu=Feishu -settings.web_hook_name_larksuite=Lark Suite +settings.web_hook_name_feishu=Feishu / Lark Suite +settings.web_hook_name_feishu_only =Feishu +settings.web_hook_name_larksuite_only =Lark Suite settings.web_hook_name_wechatwork=WeCom (Wechat Work) settings.web_hook_name_packagist=Packagist settings.packagist_username=Όνομα χρήστη Packagist diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index c28ed6c376..67ec3b1960 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2372,9 +2372,9 @@ settings.web_hook_name_dingtalk = DingTalk settings.web_hook_name_telegram = Telegram settings.web_hook_name_matrix = Matrix settings.web_hook_name_msteams = Microsoft Teams -settings.web_hook_name_feishu_or_larksuite = Feishu / Lark Suite -settings.web_hook_name_feishu = Feishu -settings.web_hook_name_larksuite = Lark Suite +settings.web_hook_name_feishu = Feishu / Lark Suite +settings.web_hook_name_feishu_only = Feishu +settings.web_hook_name_larksuite_only = Lark Suite settings.web_hook_name_wechatwork = WeCom (Wechat Work) settings.web_hook_name_packagist = Packagist settings.packagist_username = Packagist username diff --git a/options/locale/locale_es-ES.ini b/options/locale/locale_es-ES.ini index 3dbca87381..a2794ccd3d 100644 --- a/options/locale/locale_es-ES.ini +++ b/options/locale/locale_es-ES.ini @@ -2267,9 +2267,9 @@ settings.web_hook_name_dingtalk=DingTalk settings.web_hook_name_telegram=Telegram settings.web_hook_name_matrix=Matrix settings.web_hook_name_msteams=Microsoft Teams -settings.web_hook_name_feishu_or_larksuite=Feishu / Lark Suite -settings.web_hook_name_feishu=Feishu -settings.web_hook_name_larksuite=Lark Suite +settings.web_hook_name_feishu=Feishu / Lark Suite +settings.web_hook_name_feishu_only =Feishu +settings.web_hook_name_larksuite_only =Lark Suite settings.web_hook_name_wechatwork=WeCom (Wechat Work) settings.web_hook_name_packagist=Packagist settings.packagist_username=Nombre de usuario Packagist diff --git a/options/locale/locale_fi-FI.ini b/options/locale/locale_fi-FI.ini index c6c64ad6ce..31dca19f33 100644 --- a/options/locale/locale_fi-FI.ini +++ b/options/locale/locale_fi-FI.ini @@ -1184,8 +1184,8 @@ settings.web_hook_name_discord=Discord settings.web_hook_name_dingtalk=DingTalk settings.web_hook_name_telegram=Telegram settings.web_hook_name_matrix=Matrix -settings.web_hook_name_feishu=Feishu -settings.web_hook_name_larksuite=Lark Suite +settings.web_hook_name_feishu_only =Feishu +settings.web_hook_name_larksuite_only =Lark Suite settings.web_hook_name_packagist=Packagist settings.deploy_keys=Julkaisuavaimet settings.add_deploy_key=Lisää julkaisuavain diff --git a/options/locale/locale_fr-FR.ini b/options/locale/locale_fr-FR.ini index 659615e6ff..d3e015a632 100644 --- a/options/locale/locale_fr-FR.ini +++ b/options/locale/locale_fr-FR.ini @@ -2317,9 +2317,9 @@ settings.web_hook_name_dingtalk=DingTalk settings.web_hook_name_telegram=Telegram settings.web_hook_name_matrix=Matrix settings.web_hook_name_msteams=Microsoft Teams -settings.web_hook_name_feishu_or_larksuite=Feishu / Lark Suite -settings.web_hook_name_feishu=Feishu -settings.web_hook_name_larksuite=Lark Suite +settings.web_hook_name_feishu=Feishu / Lark Suite +settings.web_hook_name_feishu_only =Feishu +settings.web_hook_name_larksuite_only =Lark Suite settings.web_hook_name_wechatwork=WeCom (Wechat Work) settings.web_hook_name_packagist=Packagist settings.packagist_username=Nom d'utilisateur Packagist diff --git a/options/locale/locale_is-IS.ini b/options/locale/locale_is-IS.ini index 27b9a4b17c..e76174cde2 100644 --- a/options/locale/locale_is-IS.ini +++ b/options/locale/locale_is-IS.ini @@ -1065,7 +1065,7 @@ settings.web_hook_name_discord=Discord settings.web_hook_name_dingtalk=DingTalk settings.web_hook_name_telegram=Telegram settings.web_hook_name_msteams=Microsoft Teams -settings.web_hook_name_feishu=Feishu +settings.web_hook_name_feishu_only =Feishu settings.title=Heiti settings.deploy_key_content=Innihald settings.branches=Greinar diff --git a/options/locale/locale_it-IT.ini b/options/locale/locale_it-IT.ini index dc6f4c127e..d25fc0942d 100644 --- a/options/locale/locale_it-IT.ini +++ b/options/locale/locale_it-IT.ini @@ -2085,9 +2085,9 @@ settings.web_hook_name_dingtalk=DingTalk settings.web_hook_name_telegram=Telegram settings.web_hook_name_matrix=Matrix settings.web_hook_name_msteams=Microsoft Teams -settings.web_hook_name_feishu_or_larksuite=Feishu / Lark Suite -settings.web_hook_name_feishu=Feishu -settings.web_hook_name_larksuite=Lark Suite +settings.web_hook_name_feishu=Feishu / Lark Suite +settings.web_hook_name_feishu_only =Feishu +settings.web_hook_name_larksuite_only =Lark Suite settings.web_hook_name_wechatwork=WeCom (Wechat Work) settings.web_hook_name_packagist=Packagist settings.packagist_username=Nome utente Packagist diff --git a/options/locale/locale_ja-JP.ini b/options/locale/locale_ja-JP.ini index 7f3e1ded36..8dbc3e90bf 100644 --- a/options/locale/locale_ja-JP.ini +++ b/options/locale/locale_ja-JP.ini @@ -2301,9 +2301,9 @@ settings.web_hook_name_dingtalk=DingTalk settings.web_hook_name_telegram=Telegram settings.web_hook_name_matrix=Matrix settings.web_hook_name_msteams=Microsoft Teams -settings.web_hook_name_feishu_or_larksuite=Feishu / Lark Suite -settings.web_hook_name_feishu=Feishu -settings.web_hook_name_larksuite=Lark Suite +settings.web_hook_name_feishu=Feishu / Lark Suite +settings.web_hook_name_feishu_only =Feishu +settings.web_hook_name_larksuite_only =Lark Suite settings.web_hook_name_wechatwork=WeCom (Wechat Work) settings.web_hook_name_packagist=Packagist settings.packagist_username=Packagist ユーザー名 diff --git a/options/locale/locale_lv-LV.ini b/options/locale/locale_lv-LV.ini index ce8f05e4b5..20ca341ee4 100644 --- a/options/locale/locale_lv-LV.ini +++ b/options/locale/locale_lv-LV.ini @@ -2253,9 +2253,9 @@ settings.web_hook_name_dingtalk=DingTalk settings.web_hook_name_telegram=Telegram settings.web_hook_name_matrix=Matrix settings.web_hook_name_msteams=Microsoft Teams -settings.web_hook_name_feishu_or_larksuite=Feishu / Lark Suite -settings.web_hook_name_feishu=Feishu -settings.web_hook_name_larksuite=Lark Suite +settings.web_hook_name_feishu=Feishu / Lark Suite +settings.web_hook_name_feishu_only =Feishu +settings.web_hook_name_larksuite_only =Lark Suite settings.web_hook_name_wechatwork=WeCom (Wechat Work) settings.web_hook_name_packagist=Packagist settings.packagist_username=Packagist lietotājvārds diff --git a/options/locale/locale_nl-NL.ini b/options/locale/locale_nl-NL.ini index 4358cc1e81..41af8e7b03 100644 --- a/options/locale/locale_nl-NL.ini +++ b/options/locale/locale_nl-NL.ini @@ -2030,9 +2030,9 @@ settings.web_hook_name_dingtalk=DingTalk settings.web_hook_name_telegram=Telegram settings.web_hook_name_matrix=Matrix settings.web_hook_name_msteams=Microsoft Teams -settings.web_hook_name_feishu_or_larksuite=Feishu / Lark Suite -settings.web_hook_name_feishu=Feishu -settings.web_hook_name_larksuite=Lark Suite +settings.web_hook_name_feishu=Feishu / Lark Suite +settings.web_hook_name_feishu_only =Feishu +settings.web_hook_name_larksuite_only =Lark Suite settings.web_hook_name_wechatwork=WeCom (Wechat Work) settings.web_hook_name_packagist=Packagist settings.packagist_username=Packagist gebruikersnaam diff --git a/options/locale/locale_pt-BR.ini b/options/locale/locale_pt-BR.ini index 086cea74fa..f2a72c5c7f 100644 --- a/options/locale/locale_pt-BR.ini +++ b/options/locale/locale_pt-BR.ini @@ -2236,9 +2236,9 @@ settings.web_hook_name_dingtalk=DingTalk settings.web_hook_name_telegram=Telegram settings.web_hook_name_matrix=Matrix settings.web_hook_name_msteams=Microsoft Teams -settings.web_hook_name_feishu_or_larksuite=Feishu / Lark Suite -settings.web_hook_name_feishu=Feishu -settings.web_hook_name_larksuite=Lark Suite +settings.web_hook_name_feishu=Feishu / Lark Suite +settings.web_hook_name_feishu_only =Feishu +settings.web_hook_name_larksuite_only =Lark Suite settings.web_hook_name_wechatwork=WeCom (Wechat Work) settings.web_hook_name_packagist=Packagist settings.packagist_username=Nome de usuário no Packagist diff --git a/options/locale/locale_pt-PT.ini b/options/locale/locale_pt-PT.ini index 3538ac9460..552695a455 100644 --- a/options/locale/locale_pt-PT.ini +++ b/options/locale/locale_pt-PT.ini @@ -2269,9 +2269,9 @@ settings.web_hook_name_dingtalk=DingTalk settings.web_hook_name_telegram=Telegram settings.web_hook_name_matrix=Matrix settings.web_hook_name_msteams=Microsoft Teams -settings.web_hook_name_feishu_or_larksuite=Feishu / Lark Suite -settings.web_hook_name_feishu=Feishu -settings.web_hook_name_larksuite=Lark Suite +settings.web_hook_name_feishu=Feishu / Lark Suite +settings.web_hook_name_feishu_only =Feishu +settings.web_hook_name_larksuite_only =Lark Suite settings.web_hook_name_wechatwork=WeCom (Wechat Work) settings.web_hook_name_packagist=Packagist settings.packagist_username=Nome de utilizador no Packagist diff --git a/options/locale/locale_ru-RU.ini b/options/locale/locale_ru-RU.ini index addc2f8110..b4d246d9f9 100644 --- a/options/locale/locale_ru-RU.ini +++ b/options/locale/locale_ru-RU.ini @@ -2276,9 +2276,9 @@ settings.web_hook_name_dingtalk=DingTalk settings.web_hook_name_telegram=Telegram settings.web_hook_name_matrix=Matrix settings.web_hook_name_msteams=Microsoft Teams -settings.web_hook_name_feishu_or_larksuite=Feishu или Lark Suite -settings.web_hook_name_feishu=Feishu -settings.web_hook_name_larksuite=Lark Suite +settings.web_hook_name_feishu=Feishu или Lark Suite +settings.web_hook_name_feishu_only =Feishu +settings.web_hook_name_larksuite_only =Lark Suite settings.web_hook_name_wechatwork=WeCom (Wechat Work) settings.web_hook_name_packagist=Packagist settings.packagist_username=Имя пользователя Packagist diff --git a/options/locale/locale_tr-TR.ini b/options/locale/locale_tr-TR.ini index 74ef77eb19..b6bb510ab4 100644 --- a/options/locale/locale_tr-TR.ini +++ b/options/locale/locale_tr-TR.ini @@ -2252,9 +2252,9 @@ settings.web_hook_name_dingtalk=DingTalk settings.web_hook_name_telegram=Telegram settings.web_hook_name_matrix=Matrix settings.web_hook_name_msteams=Microsoft Teams -settings.web_hook_name_feishu_or_larksuite=Feishu / Lark Suite -settings.web_hook_name_feishu=Feishu -settings.web_hook_name_larksuite=Lark Suite +settings.web_hook_name_feishu=Feishu / Lark Suite +settings.web_hook_name_feishu_only =Feishu +settings.web_hook_name_larksuite_only =Lark Suite settings.web_hook_name_wechatwork=WeCom (Wechat Work) settings.web_hook_name_packagist=Packagist settings.packagist_username=Packagist kullanıcı adı diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 4ca2e70f21..b4e21c23ee 100644 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -2316,9 +2316,9 @@ settings.web_hook_name_dingtalk=钉钉 settings.web_hook_name_telegram=Telegram settings.web_hook_name_matrix=Matrix settings.web_hook_name_msteams=Microsoft Teams -settings.web_hook_name_feishu_or_larksuite=飞书 / Lark Suite -settings.web_hook_name_feishu=飞书 -settings.web_hook_name_larksuite=Lark Suite +settings.web_hook_name_feishu=飞书 / Lark Suite +settings.web_hook_name_feishu_only =飞书 +settings.web_hook_name_larksuite_only =Lark Suite settings.web_hook_name_wechatwork=企业微信 settings.web_hook_name_packagist=Packagist settings.packagist_username=Packagist 用户名 diff --git a/options/locale/locale_zh-TW.ini b/options/locale/locale_zh-TW.ini index 5bfff77fd2..a2e3f512ff 100644 --- a/options/locale/locale_zh-TW.ini +++ b/options/locale/locale_zh-TW.ini @@ -2071,9 +2071,9 @@ settings.web_hook_name_dingtalk=DingTalk settings.web_hook_name_telegram=Telegram settings.web_hook_name_matrix=Matrix settings.web_hook_name_msteams=Microsoft Teams -settings.web_hook_name_feishu_or_larksuite=Feishu / Lark Suite -settings.web_hook_name_feishu=Feishu -settings.web_hook_name_larksuite=Lark Suite +settings.web_hook_name_feishu=Feishu / Lark Suite +settings.web_hook_name_feishu_only =Feishu +settings.web_hook_name_larksuite_only =Lark Suite settings.web_hook_name_wechatwork=WeCom (Wechat Work) settings.web_hook_name_packagist=Packagist settings.packagist_username=Packagist 帳號 diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go index 494ada4323..0be734abaf 100644 --- a/routers/web/org/setting.go +++ b/routers/web/org/setting.go @@ -26,6 +26,7 @@ import ( org_service "code.gitea.io/gitea/services/org" repo_service "code.gitea.io/gitea/services/repository" user_service "code.gitea.io/gitea/services/user" + webhook_service "code.gitea.io/gitea/services/webhook" ) const ( @@ -210,6 +211,7 @@ func Webhooks(ctx *context.Context) { ctx.Data["PageIsSettingsHooks"] = true ctx.Data["BaseLink"] = ctx.Org.OrgLink + "/settings/hooks" ctx.Data["BaseLinkNew"] = ctx.Org.OrgLink + "/settings/hooks" + ctx.Data["WebhookList"] = webhook_service.List() ctx.Data["Description"] = ctx.Tr("org.settings.hooks_desc") ws, err := db.Find[webhook.Webhook](ctx, webhook.ListWebhookOptions{OwnerID: ctx.Org.Organization.ID}) diff --git a/routers/web/repo/setting/webhook.go b/routers/web/repo/setting/webhook.go index c36ebf5b14..4469eac9e8 100644 --- a/routers/web/repo/setting/webhook.go +++ b/routers/web/repo/setting/webhook.go @@ -45,6 +45,7 @@ func WebhookList(ctx *context.Context) { ctx.Data["PageIsSettingsHooks"] = true ctx.Data["BaseLink"] = ctx.Repo.RepoLink + "/settings/hooks" ctx.Data["BaseLinkNew"] = ctx.Repo.RepoLink + "/settings/hooks" + ctx.Data["WebhookList"] = webhook_service.List() ctx.Data["Description"] = ctx.Tr("repo.settings.hooks_desc", "https://forgejo.org/docs/latest/user/webhooks/") ws, err := db.Find[webhook.Webhook](ctx, webhook.ListWebhookOptions{RepoID: ctx.Repo.Repository.ID}) @@ -141,6 +142,7 @@ func WebhookNew(ctx *context.Context) { ctx.Data["WebhookHandler"] = handler ctx.Data["BaseLink"] = orCtx.LinkNew ctx.Data["BaseLinkNew"] = orCtx.LinkNew + ctx.Data["WebhookList"] = webhook_service.List() ctx.HTML(http.StatusOK, orCtx.NewTemplate) } @@ -205,6 +207,7 @@ func WebhookCreate(ctx *context.Context) { } ctx.Data["BaseLink"] = orCtx.LinkNew ctx.Data["BaseLinkNew"] = orCtx.LinkNew + ctx.Data["WebhookList"] = webhook_service.List() if ctx.HasError() { // pre-fill the form with the submitted data @@ -339,6 +342,7 @@ func checkWebhook(ctx *context.Context) (*ownerRepoCtx, *webhook.Webhook) { } ctx.Data["BaseLink"] = orCtx.Link ctx.Data["BaseLinkNew"] = orCtx.LinkNew + ctx.Data["WebhookList"] = webhook_service.List() var w *webhook.Webhook if orCtx.RepoID > 0 { diff --git a/routers/web/user/setting/webhooks.go b/routers/web/user/setting/webhooks.go index 4423b62781..3cc67d9def 100644 --- a/routers/web/user/setting/webhooks.go +++ b/routers/web/user/setting/webhooks.go @@ -11,6 +11,7 @@ import ( "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/services/context" + webhook_service "code.gitea.io/gitea/services/webhook" ) const ( @@ -23,6 +24,7 @@ func Webhooks(ctx *context.Context) { ctx.Data["PageIsSettingsHooks"] = true ctx.Data["BaseLink"] = setting.AppSubURL + "/user/settings/hooks" ctx.Data["BaseLinkNew"] = setting.AppSubURL + "/user/settings/hooks" + ctx.Data["WebhookList"] = webhook_service.List() ctx.Data["Description"] = ctx.Tr("settings.hooks.desc") ws, err := db.Find[webhook.Webhook](ctx, webhook.ListWebhookOptions{OwnerID: ctx.Doer.ID}) diff --git a/templates/repo/settings/webhook/link_menu.tmpl b/templates/repo/settings/webhook/link_menu.tmpl index 811e262db6..2edc5af4ac 100644 --- a/templates/repo/settings/webhook/link_menu.tmpl +++ b/templates/repo/settings/webhook/link_menu.tmpl @@ -3,52 +3,10 @@ {{$size = .Size}} {{end}} diff --git a/templates/webhook/new/feishu.tmpl b/templates/webhook/new/feishu.tmpl index b691c3f18c..ead11770de 100644 --- a/templates/webhook/new/feishu.tmpl +++ b/templates/webhook/new/feishu.tmpl @@ -1,5 +1,5 @@ -

{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://feishu.cn" (ctx.Locale.Tr "repo.settings.web_hook_name_feishu")}}

-

{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://larksuite.com" (ctx.Locale.Tr "repo.settings.web_hook_name_larksuite")}}

+

{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://feishu.cn" (ctx.Locale.Tr "repo.settings.web_hook_name_feishu_only")}}

+

{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://larksuite.com" (ctx.Locale.Tr "repo.settings.web_hook_name_larksuite_only")}}

{{.CsrfTokenHtml}}