From fd283c80b76149f72cf4ba66f942806215a67b51 Mon Sep 17 00:00:00 2001 From: oliverpool Date: Wed, 27 May 2026 20:43:47 +0200 Subject: [PATCH] feat: add hint to disable the "Enable more" units hint (#12747) Following the feedback in #12565, this adds a hint to the units page when the "Enable more" hint is enabled: ![image](/attachments/32dac116-9f25-498d-9ef0-8b18b06cfc53) Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12747 Reviewed-by: 0ko <0ko@noreply.codeberg.org> Reviewed-by: Robert Wolff Reviewed-by: Gusted --- options/locale_next/locale_en-US.json | 1 + templates/repo/settings/units.tmpl | 6 ++++++ templates/user/settings/appearance.tmpl | 2 +- tests/integration/user_test.go | 8 ++++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/options/locale_next/locale_en-US.json b/options/locale_next/locale_en-US.json index 1f01726e3a..061f2c4a25 100644 --- a/options/locale_next/locale_en-US.json +++ b/options/locale_next/locale_en-US.json @@ -129,6 +129,7 @@ "search.fuzzy_tooltip": "Include results is an approximate match to the search term", "repo.settings.push_mirror.branch_filter.label": "Branch filter (optional)", "repo.settings.push_mirror.branch_filter.description": "Branches to be mirrored. Leave blank to mirror all branches. See %[2]s documentation for syntax. Examples: main, release/*", + "repo.settings.units.more_units_disable_hint": "The \"Enable more\" hint can be disabled in User settings > Appearance.", "incorrect_root_url": "This Forgejo instance is configured to be served on \"%s\". You are currently viewing Forgejo through a different URL, which may cause parts of the application to break. The canonical URL is controlled by Forgejo admins via the ROOT_URL setting in the app.ini.", "themes.names.forgejo-auto": "Forgejo (follow system theme)", "themes.names.forgejo-light": "Forgejo light", diff --git a/templates/repo/settings/units.tmpl b/templates/repo/settings/units.tmpl index a3d958068d..77436e8999 100644 --- a/templates/repo/settings/units.tmpl +++ b/templates/repo/settings/units.tmpl @@ -1,6 +1,12 @@ {{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings options")}}
+ {{if and .SignedUser.EnableRepoUnitHints (not (.Repository.AllUnitsEnabled ctx))}} + {{$settingsURL := print AppSubUrl "/user/settings/appearance#hints"}} +
+

{{ctx.Locale.Tr "repo.settings.units.more_units_disable_hint" $settingsURL}}

+
+ {{end}} {{template "repo/settings/units/overview" .}} {{template "repo/settings/units/issues" .}} {{if not .IsMirror}} diff --git a/templates/user/settings/appearance.tmpl b/templates/user/settings/appearance.tmpl index 1656ea3b07..315206d30c 100644 --- a/templates/user/settings/appearance.tmpl +++ b/templates/user/settings/appearance.tmpl @@ -71,7 +71,7 @@
-

+

{{ctx.Locale.Tr "settings.hints"}}

diff --git a/tests/integration/user_test.go b/tests/integration/user_test.go index 1177a18801..2ffa169af8 100644 --- a/tests/integration/user_test.go +++ b/tests/integration/user_test.go @@ -502,11 +502,19 @@ func TestUserHints(t *testing.T) { assertAddMore := func(t *testing.T, present bool) { t.Helper() + // check if the tab is present req := NewRequest(t, "GET", repo.Link()) resp := session.MakeRequest(t, req, http.StatusOK) htmlDoc := NewHTMLParser(t, resp.Body) htmlDoc.AssertElement(t, fmt.Sprintf("a[href='%s/settings/units']", repo.Link()), present) + + // check if the user settings hint is present + req = NewRequest(t, "GET", repo.Link()+"/settings/units") + resp = session.MakeRequest(t, req, http.StatusOK) + htmlDoc = NewHTMLParser(t, resp.Body) + + htmlDoc.AssertElement(t, ".user-main-content a[href='/user/settings/appearance#hints']", present) } t.Run("hints enabled", func(t *testing.T) {