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 <mahlzahn@posteo.de>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
oliverpool 2026-05-27 20:43:47 +02:00 committed by 0ko
parent c8fa66d42c
commit fd283c80b7
4 changed files with 16 additions and 1 deletions

View file

@ -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 <a href=\"%[1]s\">%[2]s documentation</a> for syntax. Examples: <code>main, release/*</code>",
"repo.settings.units.more_units_disable_hint": "The \"Enable more\" hint can be disabled in <a href=\"%s\">User settings > Appearance</a>.",
"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",

View file

@ -1,6 +1,12 @@
{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings options")}}
<div class="user-main-content twelve wide column">
<form class="ui form" method="post" action="{{.RepoLink}}/settings/units">
{{if and .SignedUser.EnableRepoUnitHints (not (.Repository.AllUnitsEnabled ctx))}}
{{$settingsURL := print AppSubUrl "/user/settings/appearance#hints"}}
<div class="ui attached segment">
<p>{{ctx.Locale.Tr "repo.settings.units.more_units_disable_hint" $settingsURL}}</p>
</div>
{{end}}
{{template "repo/settings/units/overview" .}}
{{template "repo/settings/units/issues" .}}
{{if not .IsMirror}}

View file

@ -71,7 +71,7 @@
</div>
<!-- Hints -->
<h4 class="ui top attached header">
<h4 id="hints" class="ui top attached header">
{{ctx.Locale.Tr "settings.hints"}}
</h4>
<div class="ui attached segment">

View file

@ -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) {