fix(ui): fix typo in issue sort dropdown; relevance was misnamed as relevency (#12771)

closes #12769

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12771
Reviewed-by: Robert Wolff <mahlzahn@posteo.de>
This commit is contained in:
Shiny Nematoda 2026-05-28 20:48:25 +02:00 committed by Gusted
parent 44b93ff7cc
commit 6f5df4fae6
2 changed files with 28 additions and 11 deletions

View file

@ -148,11 +148,14 @@
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu">
{{$keyword := StringUtils.RemoveAllPrefix $.Keyword "sort:"}}
<a rel="nofollow" class="{{if or (eq .SortType "relevance") (not .SortType)}}active {{end}}item" href="?q={{$keyword}}&type={{$.ViewType}}&sort=relevency&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_sort.relevance"}}</a>
{{$o := .}}
{{range $opt := StringUtils.Make "latest" "oldest" "recentupdate" "leastupdate" "mostcomment" "leastcomment" "nearduedate" "farduedate"}}
{{$sortType := .SortType}}
{{if not .SortType}}
{{$sortType = "relevance"}}
{{end}}
{{range $opt := StringUtils.Make "relevance" "latest" "oldest" "recentupdate" "leastupdate" "mostcomment" "leastcomment" "nearduedate" "farduedate"}}
{{$text := ctx.Locale.Tr (printf "repo.issues.filter_sort.%s" $opt)}}
<a rel="nofollow" class="{{if eq $o.SortType $opt}}active {{end}}item" href="?q={{$keyword}}&type={{$.ViewType}}&sort={{$opt}}&state={{$.State}}&labels={{$o.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{$text}}</a>
<a rel="nofollow" class="{{if eq $sortType $opt}}active {{end}}item" href="?q={{$keyword}}&type={{$.ViewType}}&sort={{$opt}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{$text}}</a>
{{end}}
</div>
</div>

View file

@ -5,6 +5,7 @@ package integration
import (
"net/http"
"net/url"
"testing"
"forgejo.org/modules/translation"
@ -12,6 +13,7 @@ import (
"github.com/PuerkitoBio/goquery"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
// Tests for contents of pages .../issues and .../pulls
@ -45,9 +47,8 @@ func TestIssueSorting(t *testing.T) {
htmlDoc.Find(`.list-header-sort .menu a`).Length(),
"Wrong amount of sort options in dropdown")
menuItemsHTML := htmlDoc.Find(`.list-header-sort .menu`).Text()
locale := translation.NewLocale("en-US")
for _, key := range []string{
keys := []string{
"relevance",
"latest",
"oldest",
@ -57,12 +58,25 @@ func TestIssueSorting(t *testing.T) {
"leastcomment",
"nearduedate",
"farduedate",
} {
assert.Contains(t,
menuItemsHTML,
locale.Tr("repo.issues.filter_sort."+key),
"Sort option %s ('%s') not found in dropdown", key, locale.Tr("repo.issues.filter_sort."+key))
}
actual := htmlDoc.
Find(`.list-header-sort .menu .item`).
Map(func(i int, element *goquery.Selection) string {
href, ok := element.Attr("href")
assert.True(t, ok)
values, err := url.ParseQuery(href)
require.NoError(t, err)
assert.True(t, values.Has("sort"))
sort := values.Get("sort")
assert.Contains(t, keys, sort)
assert.Contains(t, element.Text(), locale.Tr("repo.issues.filter_sort."+sort))
return sort
})
assert.Equal(t, keys, actual)
})
}