diff --git a/.deadcode-out b/.deadcode-out index c63fd9e0a..1b65e3203 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 5b9bb0715..6b482d3f2 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 3747ae28c..86e7f54d8 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 f5aafdf5c..9792692a7 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 36b7518c6..b9d2881d8 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 c28ed6c37..67ec3b196 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 3dbca8738..a2794ccd3 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 c6c64ad6c..31dca19f3 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 659615e6f..d3e015a63 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 27b9a4b17..e76174cde 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 dc6f4c127..d25fc0942 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 7f3e1ded3..8dbc3e90b 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 ce8f05e4b..20ca341ee 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 4358cc1e8..41af8e7b0 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 086cea74f..f2a72c5c7 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 3538ac946..552695a45 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 addc2f811..b4d246d9f 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 74ef77eb1..b6bb510ab 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 4ca2e70f2..b4e21c23e 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 5bfff77fd..a2e3f512f 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 494ada432..0be734aba 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 c36ebf5b1..4469eac9e 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 4423b6278..3cc67d9de 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 811e262db..2edc5af4a 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 b691c3f18..ead11770d 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}}