From 2a6af15448312789ef604b70f8212a6e8e533620 Mon Sep 17 00:00:00 2001 From: GiteaBot Date: Sun, 26 Oct 2025 00:38:59 +0000 Subject: [PATCH 1/5] [skip ci] Updated translations via Crowdin --- options/locale/locale_cs-CZ.ini | 1 + options/locale/locale_de-DE.ini | 1 + options/locale/locale_el-GR.ini | 1 + options/locale/locale_es-ES.ini | 1 + options/locale/locale_fa-IR.ini | 1 + options/locale/locale_fi-FI.ini | 1 + options/locale/locale_fr-FR.ini | 1 + options/locale/locale_ga-IE.ini | 1 + options/locale/locale_hu-HU.ini | 1 + options/locale/locale_id-ID.ini | 1 + options/locale/locale_is-IS.ini | 1 + options/locale/locale_it-IT.ini | 1 + options/locale/locale_ja-JP.ini | 1 + options/locale/locale_ko-KR.ini | 1 + options/locale/locale_lv-LV.ini | 1 + options/locale/locale_nl-NL.ini | 1 + options/locale/locale_pl-PL.ini | 1 + options/locale/locale_pt-BR.ini | 1 + options/locale/locale_pt-PT.ini | 1 + options/locale/locale_ru-RU.ini | 1 + options/locale/locale_si-LK.ini | 1 + options/locale/locale_sk-SK.ini | 1 + options/locale/locale_sv-SE.ini | 1 + options/locale/locale_tr-TR.ini | 1 + options/locale/locale_uk-UA.ini | 1 + options/locale/locale_zh-CN.ini | 1 + options/locale/locale_zh-HK.ini | 1 + options/locale/locale_zh-TW.ini | 1 + 28 files changed, 28 insertions(+) diff --git a/options/locale/locale_cs-CZ.ini b/options/locale/locale_cs-CZ.ini index 26c1131a56..384c650054 100644 --- a/options/locale/locale_cs-CZ.ini +++ b/options/locale/locale_cs-CZ.ini @@ -3586,6 +3586,7 @@ variables.update.success=Proměnná byla upravena. logs.always_auto_scroll=Vždy automaticky posouvat logy logs.always_expand_running=Vždy rozšířit běžící logy + [projects] deleted.display_name=Odstraněný projekt type-1.display_name=Samostatný projekt diff --git a/options/locale/locale_de-DE.ini b/options/locale/locale_de-DE.ini index 3613032b2d..a4ff1e8a08 100644 --- a/options/locale/locale_de-DE.ini +++ b/options/locale/locale_de-DE.ini @@ -3645,6 +3645,7 @@ variables.update.success=Die Variable wurde bearbeitet. logs.always_auto_scroll=Autoscroll für Logs immer aktivieren logs.always_expand_running=Laufende Logs immer erweitern + [projects] deleted.display_name=Gelöschtes Projekt type-1.display_name=Individuelles Projekt diff --git a/options/locale/locale_el-GR.ini b/options/locale/locale_el-GR.ini index 42b23dea05..86397138a3 100644 --- a/options/locale/locale_el-GR.ini +++ b/options/locale/locale_el-GR.ini @@ -3280,6 +3280,7 @@ variables.update.failed=Αποτυχία επεξεργασίας μεταβλη variables.update.success=Η μεταβλητή έχει τροποποιηθεί. + [projects] type-1.display_name=Ατομικό Έργο type-2.display_name=Έργο Αποθετηρίου diff --git a/options/locale/locale_es-ES.ini b/options/locale/locale_es-ES.ini index ffacb46b19..cf87084f3b 100644 --- a/options/locale/locale_es-ES.ini +++ b/options/locale/locale_es-ES.ini @@ -3257,6 +3257,7 @@ variables.update.failed=Error al editar la variable. variables.update.success=La variable ha sido editada. + [projects] type-1.display_name=Proyecto individual type-2.display_name=Proyecto repositorio diff --git a/options/locale/locale_fa-IR.ini b/options/locale/locale_fa-IR.ini index abeef31988..b0a6cc799f 100644 --- a/options/locale/locale_fa-IR.ini +++ b/options/locale/locale_fa-IR.ini @@ -2446,6 +2446,7 @@ runs.commit=کامیت + [projects] [git.filemode] diff --git a/options/locale/locale_fi-FI.ini b/options/locale/locale_fi-FI.ini index 9d7fc033c4..c9c3ca4e2a 100644 --- a/options/locale/locale_fi-FI.ini +++ b/options/locale/locale_fi-FI.ini @@ -1693,6 +1693,7 @@ runs.commit=Commit + [projects] [git.filemode] diff --git a/options/locale/locale_fr-FR.ini b/options/locale/locale_fr-FR.ini index 7fc8ba3b11..2a00efc479 100644 --- a/options/locale/locale_fr-FR.ini +++ b/options/locale/locale_fr-FR.ini @@ -3906,6 +3906,7 @@ variables.update.success=La variable a bien été modifiée. logs.always_auto_scroll=Toujours faire défiler les journaux automatiquement logs.always_expand_running=Toujours développer les journaux en cours + [projects] deleted.display_name=Projet supprimé type-1.display_name=Projet personnel diff --git a/options/locale/locale_ga-IE.ini b/options/locale/locale_ga-IE.ini index 8173b92acc..8db1ef2f30 100644 --- a/options/locale/locale_ga-IE.ini +++ b/options/locale/locale_ga-IE.ini @@ -3914,6 +3914,7 @@ variables.update.success=Tá an t-athróg curtha in eagar. logs.always_auto_scroll=Logchomhaid scrollaithe uathoibríoch i gcónaí logs.always_expand_running=Leathnaigh logs reatha i gcónaí + [projects] deleted.display_name=Tionscadal scriosta type-1.display_name=Tionscadal Aonair diff --git a/options/locale/locale_hu-HU.ini b/options/locale/locale_hu-HU.ini index 0fc86f0775..b2a54fa7b7 100644 --- a/options/locale/locale_hu-HU.ini +++ b/options/locale/locale_hu-HU.ini @@ -1605,6 +1605,7 @@ runs.commit=Commit + [projects] [git.filemode] diff --git a/options/locale/locale_id-ID.ini b/options/locale/locale_id-ID.ini index a5640655d2..aff4a3bbc3 100644 --- a/options/locale/locale_id-ID.ini +++ b/options/locale/locale_id-ID.ini @@ -1428,6 +1428,7 @@ variables.update.failed=Gagal mengedit variabel. variables.update.success=Variabel telah diedit. + [projects] type-1.display_name=Proyek Individu type-2.display_name=Proyek Repositori diff --git a/options/locale/locale_is-IS.ini b/options/locale/locale_is-IS.ini index 177cf61068..6e3041c593 100644 --- a/options/locale/locale_is-IS.ini +++ b/options/locale/locale_is-IS.ini @@ -1334,6 +1334,7 @@ runs.commit=Framlag + [projects] [git.filemode] diff --git a/options/locale/locale_it-IT.ini b/options/locale/locale_it-IT.ini index 31aebff2d6..fff612a896 100644 --- a/options/locale/locale_it-IT.ini +++ b/options/locale/locale_it-IT.ini @@ -2706,6 +2706,7 @@ runs.commit=Commit + [projects] [git.filemode] diff --git a/options/locale/locale_ja-JP.ini b/options/locale/locale_ja-JP.ini index 475954f03a..3dfd143d37 100644 --- a/options/locale/locale_ja-JP.ini +++ b/options/locale/locale_ja-JP.ini @@ -3910,6 +3910,7 @@ variables.update.success=変数を更新しました。 logs.always_auto_scroll=常にログを自動スクロール logs.always_expand_running=常に実行中のログを展開 + [projects] deleted.display_name=削除されたプロジェクト type-1.display_name=個人プロジェクト diff --git a/options/locale/locale_ko-KR.ini b/options/locale/locale_ko-KR.ini index 39df68f126..405bcdd98b 100644 --- a/options/locale/locale_ko-KR.ini +++ b/options/locale/locale_ko-KR.ini @@ -1554,6 +1554,7 @@ runs.commit=커밋 + [projects] [git.filemode] diff --git a/options/locale/locale_lv-LV.ini b/options/locale/locale_lv-LV.ini index 9c8f47534b..81f8aaaf28 100644 --- a/options/locale/locale_lv-LV.ini +++ b/options/locale/locale_lv-LV.ini @@ -3282,6 +3282,7 @@ variables.update.failed=Neizdevās labot mainīgo. variables.update.success=Mainīgais tika labots. + [projects] type-1.display_name=Individuālais projekts type-2.display_name=Repozitorija projekts diff --git a/options/locale/locale_nl-NL.ini b/options/locale/locale_nl-NL.ini index 326a203c8f..7a0c2b3f5a 100644 --- a/options/locale/locale_nl-NL.ini +++ b/options/locale/locale_nl-NL.ini @@ -2458,6 +2458,7 @@ runs.commit=Commit + [projects] [git.filemode] diff --git a/options/locale/locale_pl-PL.ini b/options/locale/locale_pl-PL.ini index 872f1104ab..540f5ee629 100644 --- a/options/locale/locale_pl-PL.ini +++ b/options/locale/locale_pl-PL.ini @@ -2347,6 +2347,7 @@ runs.commit=Commit + [projects] [git.filemode] diff --git a/options/locale/locale_pt-BR.ini b/options/locale/locale_pt-BR.ini index b6292c139b..d5bd3175f8 100644 --- a/options/locale/locale_pt-BR.ini +++ b/options/locale/locale_pt-BR.ini @@ -3615,6 +3615,7 @@ variables.update.failed=Falha ao editar a variável. variables.update.success=A variável foi editada. + [projects] deleted.display_name=Excluir Projeto type-1.display_name=Projeto Individual diff --git a/options/locale/locale_pt-PT.ini b/options/locale/locale_pt-PT.ini index 4497a589d4..39168bdaaa 100644 --- a/options/locale/locale_pt-PT.ini +++ b/options/locale/locale_pt-PT.ini @@ -3914,6 +3914,7 @@ variables.update.success=A variável foi editada. logs.always_auto_scroll=Rolar registos de forma automática e permanente logs.always_expand_running=Expandir sempre os registos que vão rolando + [projects] deleted.display_name=Planeamento eliminado type-1.display_name=Planeamento individual diff --git a/options/locale/locale_ru-RU.ini b/options/locale/locale_ru-RU.ini index 6da0eea91c..2625b4382b 100644 --- a/options/locale/locale_ru-RU.ini +++ b/options/locale/locale_ru-RU.ini @@ -3225,6 +3225,7 @@ variables.update.failed=Не удалось изменить переменну variables.update.success=Переменная изменена. + [projects] type-1.display_name=Индивидуальный проект type-2.display_name=Проект репозитория diff --git a/options/locale/locale_si-LK.ini b/options/locale/locale_si-LK.ini index e065527bbe..49ca5b042e 100644 --- a/options/locale/locale_si-LK.ini +++ b/options/locale/locale_si-LK.ini @@ -2391,6 +2391,7 @@ runs.commit=කැප + [projects] [git.filemode] diff --git a/options/locale/locale_sk-SK.ini b/options/locale/locale_sk-SK.ini index dc022da24b..54b8326f33 100644 --- a/options/locale/locale_sk-SK.ini +++ b/options/locale/locale_sk-SK.ini @@ -1292,6 +1292,7 @@ runners.labels=Štítky + [projects] [git.filemode] diff --git a/options/locale/locale_sv-SE.ini b/options/locale/locale_sv-SE.ini index e8c13cae0d..79abdce4ab 100644 --- a/options/locale/locale_sv-SE.ini +++ b/options/locale/locale_sv-SE.ini @@ -1968,6 +1968,7 @@ runs.commit=Commit + [projects] [git.filemode] diff --git a/options/locale/locale_tr-TR.ini b/options/locale/locale_tr-TR.ini index ccc74293f5..8be6a587fb 100644 --- a/options/locale/locale_tr-TR.ini +++ b/options/locale/locale_tr-TR.ini @@ -3907,6 +3907,7 @@ variables.update.success=Değişken düzenlendi. logs.always_auto_scroll=Günlükleri her zaman otomatik kaydır logs.always_expand_running=Çalıştırma günlüklerini her zaman genişlet + [projects] deleted.display_name=Silinmiş Proje type-1.display_name=Kişisel Proje diff --git a/options/locale/locale_uk-UA.ini b/options/locale/locale_uk-UA.ini index 1849d5d378..b3d0c37cbe 100644 --- a/options/locale/locale_uk-UA.ini +++ b/options/locale/locale_uk-UA.ini @@ -3428,6 +3428,7 @@ variables.update.success=Змінну відредаговано. logs.always_auto_scroll=Завжди автоматично прокручувати журнали logs.always_expand_running=Завжди розгортати поточні журнали + [projects] deleted.display_name=Видалений проєкт type-1.display_name=Індивідуальний проєкт diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 29eb6be949..9db58e71ac 100644 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -3911,6 +3911,7 @@ variables.update.success=变量已编辑。 logs.always_auto_scroll=总是自动滚动日志 logs.always_expand_running=总是展开运行日志 + [projects] deleted.display_name=已删除项目 type-1.display_name=个人项目 diff --git a/options/locale/locale_zh-HK.ini b/options/locale/locale_zh-HK.ini index 8a8c2a7bb6..617977577d 100644 --- a/options/locale/locale_zh-HK.ini +++ b/options/locale/locale_zh-HK.ini @@ -980,6 +980,7 @@ runners.task_list.repository=儲存庫 + [projects] [git.filemode] diff --git a/options/locale/locale_zh-TW.ini b/options/locale/locale_zh-TW.ini index c7166bbd6c..74356c6cde 100644 --- a/options/locale/locale_zh-TW.ini +++ b/options/locale/locale_zh-TW.ini @@ -3554,6 +3554,7 @@ variables.update.failed=編輯變數失敗。 variables.update.success=已編輯變數。 + [projects] deleted.display_name=已刪除的專案 type-1.display_name=個人專案 From bc50431e8b8dbbc979084ca37af24e283d2c80c0 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 26 Oct 2025 06:52:01 -0700 Subject: [PATCH 2/5] Upgrade go mail to 0.7.2 (#35748) --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index cf4774801e..81187804a3 100644 --- a/go.mod +++ b/go.mod @@ -109,7 +109,7 @@ require ( github.com/ulikunitz/xz v0.5.15 github.com/urfave/cli-docs/v3 v3.0.0-alpha6 github.com/urfave/cli/v3 v3.4.1 - github.com/wneessen/go-mail v0.7.1 + github.com/wneessen/go-mail v0.7.2 github.com/xeipuuv/gojsonschema v1.2.0 github.com/yohcop/openid-go v1.0.1 github.com/yuin/goldmark v1.7.13 diff --git a/go.sum b/go.sum index 9acef3b977..02a710e7f0 100644 --- a/go.sum +++ b/go.sum @@ -768,8 +768,8 @@ github.com/urfave/cli/v3 v3.4.1/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZ github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ= github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= -github.com/wneessen/go-mail v0.7.1 h1:rvy63sp14N06/kdGqCYwW8Na5gDCXjTQM1E7So4PuKk= -github.com/wneessen/go-mail v0.7.1/go.mod h1:+TkW6QP3EVkgTEqHtVmnAE/1MRhmzb8Y9/W3pweuS+k= +github.com/wneessen/go-mail v0.7.2 h1:xxPnhZ6IZLSgxShebmZ6DPKh1b6OJcoHfzy7UjOkzS8= +github.com/wneessen/go-mail v0.7.2/go.mod h1:+TkW6QP3EVkgTEqHtVmnAE/1MRhmzb8Y9/W3pweuS+k= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= From 2f309b844c829744e97d34c6ace11589e21786c2 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Mon, 27 Oct 2025 05:26:38 +0800 Subject: [PATCH 3/5] Revert #18491, fix oauth2 client link account (#35745) Fix #35744 by reverting #18491 * "OpenID" options don't mean "OAuth2Client" options * "OAuth2(server)" options don't mean "OAuth2Client" options --- routers/web/web.go | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/routers/web/web.go b/routers/web/web.go index 43f104a73e..b5d283607a 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -307,13 +307,6 @@ func registerWebRoutes(m *web.Router) { validation.AddBindingRules() - linkAccountEnabled := func(ctx *context.Context) { - if !setting.Service.EnableOpenIDSignIn && !setting.Service.EnableOpenIDSignUp && !setting.OAuth2.Enabled { - ctx.HTTPError(http.StatusForbidden) - return - } - } - openIDSignInEnabled := func(ctx *context.Context) { if !setting.Service.EnableOpenIDSignIn { ctx.HTTPError(http.StatusForbidden) @@ -545,9 +538,9 @@ func registerWebRoutes(m *web.Router) { }, openIDSignInEnabled) m.Get("/sign_up", auth.SignUp) m.Post("/sign_up", web.Bind(forms.RegisterForm{}), auth.SignUpPost) - m.Get("/link_account", linkAccountEnabled, auth.LinkAccount) - m.Post("/link_account_signin", linkAccountEnabled, web.Bind(forms.SignInForm{}), auth.LinkAccountPostSignIn) - m.Post("/link_account_signup", linkAccountEnabled, web.Bind(forms.RegisterForm{}), auth.LinkAccountPostRegister) + m.Get("/link_account", auth.LinkAccount) + m.Post("/link_account_signin", web.Bind(forms.SignInForm{}), auth.LinkAccountPostSignIn) + m.Post("/link_account_signup", web.Bind(forms.RegisterForm{}), auth.LinkAccountPostRegister) m.Group("/two_factor", func() { m.Get("", auth.TwoFactor) m.Post("", web.Bind(forms.TwoFactorAuthForm{}), auth.TwoFactorPost) @@ -622,7 +615,7 @@ func registerWebRoutes(m *web.Router) { m.Post("/delete", security.DeleteOpenID) m.Post("/toggle_visibility", security.ToggleOpenIDVisibility) }, openIDSignInEnabled) - m.Post("/account_link", linkAccountEnabled, security.DeleteAccountLink) + m.Post("/account_link", security.DeleteAccountLink) }) m.Group("/applications", func() { From 87d670c96b28b030f2eb42b6096533434ca1cd25 Mon Sep 17 00:00:00 2001 From: GiteaBot Date: Mon, 27 Oct 2025 00:39:11 +0000 Subject: [PATCH 4/5] [skip ci] Updated translations via Crowdin --- options/locale/locale_ga-IE.ini | 8 ++++++++ options/locale/locale_ja-JP.ini | 4 ++++ options/locale/locale_pt-PT.ini | 8 ++++++++ 3 files changed, 20 insertions(+) diff --git a/options/locale/locale_ga-IE.ini b/options/locale/locale_ga-IE.ini index 8db1ef2f30..045fb14f8b 100644 --- a/options/locale/locale_ga-IE.ini +++ b/options/locale/locale_ga-IE.ini @@ -3914,6 +3914,14 @@ variables.update.success=Tá an t-athróg curtha in eagar. logs.always_auto_scroll=Logchomhaid scrollaithe uathoibríoch i gcónaí logs.always_expand_running=Leathnaigh logs reatha i gcónaí +general=Ginearálta +general.enable_actions=Cumasaigh Gníomhartha +general.collaborative_owners_management=Bainistíocht Chomhoibríoch Úinéirí +general.collaborative_owners_management_help=Is úsáideoir nó eagraíocht é úinéir comhoibríoch a bhfuil rochtain ag a stór príobháideach ar ghníomhartha agus ar shreafaí oibre an stórais sin. +general.add_collaborative_owner=Cuir Úinéir Comhoibríoch leis +general.collaborative_owner_not_exist=Níl an t-úinéir comhoibríoch ann. +general.remove_collaborative_owner=Bain Úinéir Comhoibríoch +general.remove_collaborative_owner_desc=Má bhaintear úinéir comhoibríoch, cuirfidh sé sin cosc ​​ar stórtha an úinéara rochtain a fháil ar na gníomhartha sa stór seo. An bhfuil tú ag iarraidh leanúint ar aghaidh? [projects] deleted.display_name=Tionscadal scriosta diff --git a/options/locale/locale_ja-JP.ini b/options/locale/locale_ja-JP.ini index 3dfd143d37..a0d4f6cb75 100644 --- a/options/locale/locale_ja-JP.ini +++ b/options/locale/locale_ja-JP.ini @@ -1969,6 +1969,9 @@ pulls.status_checks_requested=必須 pulls.status_checks_details=詳細 pulls.status_checks_hide_all=すべてのチェックを隠す pulls.status_checks_show_all=すべてのチェックを表示 +pulls.status_checks_approve_all=ワークフローをすべて承認 +pulls.status_checks_need_approvals=%d 件のワークフローが承認待ちです +pulls.status_checks_need_approvals_helper=ワークフローはリポジトリ管理者が承認した後にのみ実行されます。 pulls.update_branch=マージでブランチを更新 pulls.update_branch_rebase=リベースでブランチを更新 pulls.update_branch_success=ブランチの更新が成功しました @@ -3890,6 +3893,7 @@ workflow.has_workflow_dispatch=このワークフローには workflow_dispatch workflow.has_no_workflow_dispatch=ワークフロー '%s' には workflow_dispatch イベントトリガーがありません。 need_approval_desc=フォークプルリクエストのワークフローを実行するには承認が必要です。 +approve_all_success=すべてのワークフローの実行が正常に承認されました。 variables=変数 variables.management=変数の管理 diff --git a/options/locale/locale_pt-PT.ini b/options/locale/locale_pt-PT.ini index 39168bdaaa..95ac1fb5a4 100644 --- a/options/locale/locale_pt-PT.ini +++ b/options/locale/locale_pt-PT.ini @@ -3914,6 +3914,14 @@ variables.update.success=A variável foi editada. logs.always_auto_scroll=Rolar registos de forma automática e permanente logs.always_expand_running=Expandir sempre os registos que vão rolando +general=Geral +general.enable_actions=Habilitar Operações +general.collaborative_owners_management=Gestão de proprietários colaborativos +general.collaborative_owners_management_help=Um proprietário colaborativo é um utilizador ou uma organização cujo repositório privado tem acesso às operações e às sequências de trabalho deste repositório. +general.add_collaborative_owner=Adicionar proprietário colaborativo +general.collaborative_owner_not_exist=O proprietário colaborativo não existe. +general.remove_collaborative_owner=Remover proprietário colaborativo +general.remove_collaborative_owner_desc=A remoção de um proprietário colaborativo impedirá que os repositórios do proprietário acedam às operações neste repositório. Continuamos? [projects] deleted.display_name=Planeamento eliminado From cddff73bbdd9a1ab65661fe39420a1c08b908012 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Mon, 27 Oct 2025 22:45:07 +0800 Subject: [PATCH 5/5] Fix "ref-issue" handling in markup (#35739) This is a follow up for #35662, and also fix #31181, help #30275, fix #31161 --- templates/base/head_script.tmpl | 1 - web_src/js/components/ContextPopup.vue | 62 +++++++++++--------------- web_src/js/features/contextpopup.ts | 43 ------------------ web_src/js/features/repo-diff.ts | 4 +- web_src/js/features/repo-editor.ts | 2 - web_src/js/features/repo-issue-edit.ts | 3 -- web_src/js/index-domready.ts | 2 - web_src/js/markup/content.ts | 2 + web_src/js/markup/refissue.ts | 41 +++++++++++++++++ web_src/js/modules/tippy.ts | 4 ++ 10 files changed, 74 insertions(+), 90 deletions(-) delete mode 100644 web_src/js/features/contextpopup.ts create mode 100644 web_src/js/markup/refissue.ts diff --git a/templates/base/head_script.tmpl b/templates/base/head_script.tmpl index f6648b59d8..daef7afd28 100644 --- a/templates/base/head_script.tmpl +++ b/templates/base/head_script.tmpl @@ -36,7 +36,6 @@ If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly. copy_success: {{ctx.Locale.Tr "copy_success"}}, copy_error: {{ctx.Locale.Tr "copy_error"}}, error_occurred: {{ctx.Locale.Tr "error.occurred"}}, - network_error: {{ctx.Locale.Tr "error.network_error"}}, remove_label_str: {{ctx.Locale.Tr "remove_label_str"}}, modal_confirm: {{ctx.Locale.Tr "modal.confirm"}}, modal_cancel: {{ctx.Locale.Tr "modal.cancel"}}, diff --git a/web_src/js/components/ContextPopup.vue b/web_src/js/components/ContextPopup.vue index 5ec4499e48..aebfaa5d26 100644 --- a/web_src/js/components/ContextPopup.vue +++ b/web_src/js/components/ContextPopup.vue @@ -2,62 +2,53 @@ import {SvgIcon} from '../svg.ts'; import {GET} from '../modules/fetch.ts'; import {getIssueColor, getIssueIcon} from '../features/issue.ts'; -import {computed, onMounted, shallowRef, useTemplateRef} from 'vue'; -import type {IssuePathInfo} from '../types.ts'; +import {computed, onMounted, shallowRef} from 'vue'; -const {appSubUrl, i18n} = window.config; +const props = defineProps<{ + repoLink: string, + loadIssueInfoUrl: string, +}>(); const loading = shallowRef(false); const issue = shallowRef(null); const renderedLabels = shallowRef(''); -const i18nErrorOccurred = i18n.error_occurred; -const i18nErrorMessage = shallowRef(null); +const errorMessage = shallowRef(null); + +const createdAt = computed(() => { + return new Date(issue.value.created_at).toLocaleDateString(undefined, {year: 'numeric', month: 'short', day: 'numeric'}); +}); -const createdAt = computed(() => new Date(issue.value.created_at).toLocaleDateString(undefined, {year: 'numeric', month: 'short', day: 'numeric'})); const body = computed(() => { const body = issue.value.body.replace(/\n+/g, ' '); - if (body.length > 85) { - return `${body.substring(0, 85)}…`; - } - return body; + return body.length > 85 ? `${body.substring(0, 85)}…` : body; }); -const root = useTemplateRef('root'); - -onMounted(() => { - root.value.addEventListener('ce-load-context-popup', (e: CustomEventInit) => { - if (!loading.value && issue.value === null) { - load(e.detail); - } - }); -}); - -async function load(issuePathInfo: IssuePathInfo) { +onMounted(async () => { loading.value = true; - i18nErrorMessage.value = null; - + errorMessage.value = null; try { - const response = await GET(`${appSubUrl}/${issuePathInfo.ownerName}/${issuePathInfo.repoName}/issues/${issuePathInfo.indexString}/info`); // backend: GetIssueInfo - const respJson = await response.json(); - if (!response.ok) { - i18nErrorMessage.value = respJson.message ?? i18n.network_error; + const resp = await GET(props.loadIssueInfoUrl); + if (!resp.ok) { + errorMessage.value = resp.status ? resp.statusText : 'Unknown network error'; return; } + const respJson = await resp.json(); issue.value = respJson.convertedIssue; renderedLabels.value = respJson.renderedLabels; - } catch { - i18nErrorMessage.value = i18n.network_error; } finally { loading.value = false; } -} +}); diff --git a/web_src/js/features/contextpopup.ts b/web_src/js/features/contextpopup.ts deleted file mode 100644 index 7477331dbe..0000000000 --- a/web_src/js/features/contextpopup.ts +++ /dev/null @@ -1,43 +0,0 @@ -import {createApp} from 'vue'; -import ContextPopup from '../components/ContextPopup.vue'; -import {parseIssueHref} from '../utils.ts'; -import {createTippy} from '../modules/tippy.ts'; - -export function initContextPopups() { - const refIssues = document.querySelectorAll('.ref-issue'); - attachRefIssueContextPopup(refIssues); -} - -export function attachRefIssueContextPopup(refIssues: NodeListOf) { - for (const refIssue of refIssues) { - if (refIssue.classList.contains('ref-external-issue')) continue; - - const issuePathInfo = parseIssueHref(refIssue.getAttribute('href')); - if (!issuePathInfo.ownerName) continue; - - const el = document.createElement('div'); - el.classList.add('tw-p-3'); - refIssue.parentNode.insertBefore(el, refIssue.nextSibling); - - const view = createApp(ContextPopup); - - try { - view.mount(el); - } catch (err) { - console.error(err); - el.textContent = 'ContextPopup failed to load'; - } - - createTippy(refIssue, { - theme: 'default', - content: el, - placement: 'top-start', - interactive: true, - role: 'dialog', - interactiveBorder: 5, - onShow: () => { - el.firstChild.dispatchEvent(new CustomEvent('ce-load-context-popup', {detail: issuePathInfo})); - }, - }); - } -} diff --git a/web_src/js/features/repo-diff.ts b/web_src/js/features/repo-diff.ts index 24d937a252..20cec2939d 100644 --- a/web_src/js/features/repo-diff.ts +++ b/web_src/js/features/repo-diff.ts @@ -12,8 +12,6 @@ import {invertFileFolding} from './file-fold.ts'; import {parseDom, sleep} from '../utils.ts'; import {registerGlobalSelectorFunc} from '../modules/observer.ts'; -const {i18n} = window.config; - function initRepoDiffFileBox(el: HTMLElement) { // switch between "rendered" and "source", for image and CSV files queryElems(el, '.file-view-toggle', (btn) => btn.addEventListener('click', () => { @@ -86,7 +84,7 @@ function initRepoDiffConversationForm() { } } catch (error) { console.error('Error:', error); - showErrorToast(i18n.network_error); + showErrorToast(`Submit form failed: ${error}`); } finally { form?.classList.remove('is-loading'); } diff --git a/web_src/js/features/repo-editor.ts b/web_src/js/features/repo-editor.ts index f3ca13460c..0825999edc 100644 --- a/web_src/js/features/repo-editor.ts +++ b/web_src/js/features/repo-editor.ts @@ -1,7 +1,6 @@ import {html, htmlRaw} from '../utils/html.ts'; import {createCodeEditor} from './codeeditor.ts'; import {hideElem, queryElems, showElem, createElementFromHTML} from '../utils/dom.ts'; -import {attachRefIssueContextPopup} from './contextpopup.ts'; import {POST} from '../modules/fetch.ts'; import {initDropzone} from './dropzone.ts'; import {confirmModal} from './comp/ConfirmModal.ts'; @@ -199,5 +198,4 @@ export function initRepoEditor() { export function renderPreviewPanelContent(previewPanel: Element, htmlContent: string) { // the content is from the server, so it is safe to use innerHTML previewPanel.innerHTML = html`
${htmlRaw(htmlContent)}
`; - attachRefIssueContextPopup(previewPanel.querySelectorAll('p .ref-issue')); } diff --git a/web_src/js/features/repo-issue-edit.ts b/web_src/js/features/repo-issue-edit.ts index f883ee460b..43aee314e0 100644 --- a/web_src/js/features/repo-issue-edit.ts +++ b/web_src/js/features/repo-issue-edit.ts @@ -3,7 +3,6 @@ import {getComboMarkdownEditor, initComboMarkdownEditor, ComboMarkdownEditor} fr import {POST} from '../modules/fetch.ts'; import {showErrorToast} from '../modules/toast.ts'; import {hideElem, querySingleVisibleElem, showElem, type DOMEvent} from '../utils/dom.ts'; -import {attachRefIssueContextPopup} from './contextpopup.ts'; import {triggerUploadStateChanged} from './comp/EditorUpload.ts'; import {convertHtmlToMarkdown} from '../markup/html2markdown.ts'; import {applyAreYouSure, reinitializeAreYouSure} from '../vendor/jquery.are-you-sure.ts'; @@ -62,8 +61,6 @@ async function tryOnEditContent(e: DOMEvent) { renderContent = newRenderContent; rawContent.textContent = comboMarkdownEditor.value(); - const refIssues = renderContent.querySelectorAll('p .ref-issue'); - attachRefIssueContextPopup(refIssues); if (!commentContent.querySelector('.dropzone-attachments')) { if (data.attachments !== '') { diff --git a/web_src/js/index-domready.ts b/web_src/js/index-domready.ts index cfb6b89ea7..8a3a27fa19 100644 --- a/web_src/js/index-domready.ts +++ b/web_src/js/index-domready.ts @@ -5,7 +5,6 @@ import '../../node_modules/easymde/dist/easymde.min.css'; // TODO: lazy load in import {initHtmx} from './htmx.ts'; import {initDashboardRepoList} from './features/dashboard.ts'; import {initGlobalCopyToClipboardListener} from './features/clipboard.ts'; -import {initContextPopups} from './features/contextpopup.ts'; import {initRepoGraphGit} from './features/repo-graph.ts'; import {initHeatmap} from './features/heatmap.ts'; import {initImageDiff} from './features/imagediff.ts'; @@ -97,7 +96,6 @@ const initPerformanceTracer = callInitFunctions([ initHeadNavbarContentToggle, initFootLanguageMenu, - initContextPopups, initHeatmap, initImageDiff, initMarkupAnchors, diff --git a/web_src/js/markup/content.ts b/web_src/js/markup/content.ts index cf88ed61de..d964c88989 100644 --- a/web_src/js/markup/content.ts +++ b/web_src/js/markup/content.ts @@ -5,6 +5,7 @@ import {initMarkupRenderAsciicast} from './asciicast.ts'; import {initMarkupTasklist} from './tasklist.ts'; import {registerGlobalSelectorFunc} from '../modules/observer.ts'; import {initMarkupRenderIframe} from './render-iframe.ts'; +import {initMarkupRefIssue} from './refissue.ts'; // code that runs for all markup content export function initMarkupContent(): void { @@ -15,5 +16,6 @@ export function initMarkupContent(): void { initMarkupCodeMath(el); initMarkupRenderAsciicast(el); initMarkupRenderIframe(el); + initMarkupRefIssue(el); }); } diff --git a/web_src/js/markup/refissue.ts b/web_src/js/markup/refissue.ts new file mode 100644 index 0000000000..5a05de84fe --- /dev/null +++ b/web_src/js/markup/refissue.ts @@ -0,0 +1,41 @@ +import {queryElems} from '../utils/dom.ts'; +import {parseIssueHref} from '../utils.ts'; +import {createApp} from 'vue'; +import ContextPopup from '../components/ContextPopup.vue'; +import {createTippy, getAttachedTippyInstance} from '../modules/tippy.ts'; + +export function initMarkupRefIssue(el: HTMLElement) { + queryElems(el, '.ref-issue', (el) => { + el.addEventListener('mouseenter', showMarkupRefIssuePopup); + el.addEventListener('focus', showMarkupRefIssuePopup); + }); +} + +export function showMarkupRefIssuePopup(e: MouseEvent | FocusEvent) { + const refIssue = e.currentTarget as HTMLElement; + if (getAttachedTippyInstance(refIssue)) return; + if (refIssue.classList.contains('ref-external-issue')) return; + + const issuePathInfo = parseIssueHref(refIssue.getAttribute('href')); + if (!issuePathInfo.ownerName) return; + + const el = document.createElement('div'); + const tippy = createTippy(refIssue, { + theme: 'default', + content: el, + trigger: 'mouseenter focus', + placement: 'top-start', + interactive: true, + role: 'dialog', + interactiveBorder: 5, + // onHide() { return false }, // help to keep the popup and debug the layout + onShow: () => { + const view = createApp(ContextPopup, { + // backend: GetIssueInfo + loadIssueInfoUrl: `${window.config.appSubUrl}/${issuePathInfo.ownerName}/${issuePathInfo.repoName}/issues/${issuePathInfo.indexString}/info`, + }); + view.mount(el); + }, + }); + tippy.show(); +} diff --git a/web_src/js/modules/tippy.ts b/web_src/js/modules/tippy.ts index 2a1d998d76..6f42a4f987 100644 --- a/web_src/js/modules/tippy.ts +++ b/web_src/js/modules/tippy.ts @@ -209,3 +209,7 @@ export function showTemporaryTooltip(target: Element, content: Content): void { }, }); } + +export function getAttachedTippyInstance(el: Element): Instance | null { + return el._tippy ?? null; +}