Skip to content

Commit 70e44ad

Browse files
authored
Merge branch 'main' into lunny/move_optional_ParseBool
2 parents 11bc0c3 + 08510ad commit 70e44ad

26 files changed

+97
-67
lines changed

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ require (
6464
github.com/gobwas/glob v0.2.3
6565
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f
6666
github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85
67-
github.com/golang-jwt/jwt/v5 v5.2.1
67+
github.com/golang-jwt/jwt/v5 v5.2.2
6868
github.com/google/go-github/v61 v61.0.0
6969
github.com/google/licenseclassifier/v2 v2.0.0
7070
github.com/google/pprof v0.0.0-20250208200701-d0013a598941
@@ -99,7 +99,7 @@ require (
9999
github.com/pquerna/otp v1.4.0
100100
github.com/prometheus/client_golang v1.21.0
101101
github.com/quasoft/websspi v1.1.2
102-
github.com/redis/go-redis/v9 v9.7.0
102+
github.com/redis/go-redis/v9 v9.7.3
103103
github.com/robfig/cron/v3 v3.0.1
104104
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
105105
github.com/sassoftware/go-rpmutils v0.4.0
@@ -215,7 +215,7 @@ require (
215215
github.com/go-openapi/validate v0.24.0 // indirect
216216
github.com/go-webauthn/x v0.1.16 // indirect
217217
github.com/goccy/go-json v0.10.5 // indirect
218-
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
218+
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
219219
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
220220
github.com/golang-sql/sqlexp v0.1.0 // indirect
221221
github.com/golang/geo v0.0.0-20230421003525-6adc56603217 // indirect

go.sum

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,11 @@ github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f h1:3BSP1Tbs2djlpprl7w
374374
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f/go.mod h1:Pcatq5tYkCW2Q6yrR2VRHlbHpZ/R4/7qyL1TCF7vl14=
375375
github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85 h1:UjoPNDAQ5JPCjlxoJd6K8ALZqSDDhk2ymieAZOVaDg0=
376376
github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85/go.mod h1:fR6z1Ie6rtF7kl/vBYMfgD5/G5B1blui7z426/sj2DU=
377-
github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo=
378377
github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
379-
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
380-
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
378+
github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI=
379+
github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
380+
github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8=
381+
github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
381382
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA=
382383
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
383384
github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A=
@@ -655,8 +656,8 @@ github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoG
655656
github.com/quasoft/websspi v1.1.2 h1:/mA4w0LxWlE3novvsoEL6BBA1WnjJATbjkh1kFrTidw=
656657
github.com/quasoft/websspi v1.1.2/go.mod h1:HmVdl939dQ0WIXZhyik+ARdI03M6bQzaSEKcgpFmewk=
657658
github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
658-
github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E=
659-
github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw=
659+
github.com/redis/go-redis/v9 v9.7.3 h1:YpPyAayJV+XErNsatSElgRZZVCwXX9QzkKYNvO7x0wM=
660+
github.com/redis/go-redis/v9 v9.7.3/go.mod h1:bGUrSggJ9X9GUmZpZNEOQKaANxSGgOEBRltRTZHSvrA=
660661
github.com/redis/rueidis v1.0.19 h1:s65oWtotzlIFN8eMPhyYwxlwLR1lUdhza2KtWprKYSo=
661662
github.com/redis/rueidis v1.0.19/go.mod h1:8B+r5wdnjwK3lTFml5VtxjzGOQAC+5UmujoD12pDrEo=
662663
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk=

modules/paginator/paginator.go

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
package paginator
66

7+
import "code.gitea.io/gitea/modules/util"
8+
79
/*
810
In template:
911
@@ -32,25 +34,43 @@ Output:
3234

3335
// Paginator represents a set of results of pagination calculations.
3436
type Paginator struct {
35-
total int // total rows count
37+
total int // total rows count, -1 means unknown
38+
totalPages int // total pages count, -1 means unknown
39+
current int // current page number
40+
curRows int // current page rows count
41+
3642
pagingNum int // how many rows in one page
37-
current int // current page number
3843
numPages int // how many pages to show on the UI
3944
}
4045

4146
// New initialize a new pagination calculation and returns a Paginator as result.
4247
func New(total, pagingNum, current, numPages int) *Paginator {
43-
if pagingNum <= 0 {
44-
pagingNum = 1
48+
pagingNum = max(pagingNum, 1)
49+
totalPages := util.Iif(total == -1, -1, (total+pagingNum-1)/pagingNum)
50+
if total >= 0 {
51+
current = min(current, totalPages)
4552
}
46-
if current <= 0 {
47-
current = 1
53+
current = max(current, 1)
54+
return &Paginator{
55+
total: total,
56+
totalPages: totalPages,
57+
current: current,
58+
pagingNum: pagingNum,
59+
numPages: numPages,
4860
}
49-
p := &Paginator{total, pagingNum, current, numPages}
50-
if p.current > p.TotalPages() {
51-
p.current = p.TotalPages()
61+
}
62+
63+
func (p *Paginator) SetCurRows(rows int) {
64+
// For "unlimited paging", we need to know the rows of current page to determine if there is a next page.
65+
// There is still an edge case: when curRows==pagingNum, then the "next page" will be an empty page.
66+
// Ideally we should query one more row to determine if there is really a next page, but it's impossible in current framework.
67+
p.curRows = rows
68+
if p.total == -1 && p.current == 1 && !p.HasNext() {
69+
// if there is only one page for the "unlimited paging", set total rows/pages count
70+
// then the tmpl could decide to hide the nav bar.
71+
p.total = rows
72+
p.totalPages = util.Iif(p.total == 0, 0, 1)
5273
}
53-
return p
5474
}
5575

5676
// IsFirst returns true if current page is the first page.
@@ -72,7 +92,10 @@ func (p *Paginator) Previous() int {
7292

7393
// HasNext returns true if there is a next page relative to current page.
7494
func (p *Paginator) HasNext() bool {
75-
return p.total > p.current*p.pagingNum
95+
if p.total == -1 {
96+
return p.curRows >= p.pagingNum
97+
}
98+
return p.current*p.pagingNum < p.total
7699
}
77100

78101
func (p *Paginator) Next() int {
@@ -84,10 +107,7 @@ func (p *Paginator) Next() int {
84107

85108
// IsLast returns true if current page is the last page.
86109
func (p *Paginator) IsLast() bool {
87-
if p.total == 0 {
88-
return true
89-
}
90-
return p.total > (p.current-1)*p.pagingNum && !p.HasNext()
110+
return !p.HasNext()
91111
}
92112

93113
// Total returns number of total rows.
@@ -97,10 +117,7 @@ func (p *Paginator) Total() int {
97117

98118
// TotalPages returns number of total pages.
99119
func (p *Paginator) TotalPages() int {
100-
if p.total == 0 {
101-
return 1
102-
}
103-
return (p.total + p.pagingNum - 1) / p.pagingNum
120+
return p.totalPages
104121
}
105122

106123
// Current returns current page number.
@@ -135,10 +152,10 @@ func getMiddleIdx(numPages int) int {
135152
// If value is -1 means "..." that more pages are not showing.
136153
func (p *Paginator) Pages() []*Page {
137154
if p.numPages == 0 {
138-
return []*Page{}
139-
} else if p.numPages == 1 && p.TotalPages() == 1 {
155+
return nil
156+
} else if p.total == -1 || (p.numPages == 1 && p.TotalPages() == 1) {
140157
// Only show current page.
141-
return []*Page{{1, true}}
158+
return []*Page{{p.current, true}}
142159
}
143160

144161
// Total page number is less or equal.

modules/paginator/paginator_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ func TestPaginator(t *testing.T) {
7676
t.Run("Only current page", func(t *testing.T) {
7777
p := New(0, 10, 1, 1)
7878
pages := p.Pages()
79-
assert.Len(t, pages, 1)
80-
assert.Equal(t, 1, pages[0].Num())
81-
assert.True(t, pages[0].IsCurrent())
79+
assert.Empty(t, pages) // no "total", so no pages
8280

8381
p = New(1, 10, 1, 1)
8482
pages = p.Pages()

options/locale/locale_cs-CZ.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ oauth_signup_submit=Dokončit účet
446446
oauth_signin_tab=Propojit s existujícím účtem
447447
oauth_signin_title=Přihlaste se pro ověření propojeného účtu
448448
oauth_signin_submit=Propojit účet
449-
oauth.signin.error=Došlo k chybě při zpracování žádosti o autorizaci. Pokud tato chyba přetrvává, obraťte se na správce webu.
450449
oauth.signin.error.access_denied=Žádost o autorizaci byla zamítnuta.
451450
oauth.signin.error.temporarily_unavailable=Autorizace se nezdařila, protože ověřovací server je dočasně nedostupný. Opakujte akci později.
452451
oauth_callback_unable_auto_reg=Automatická registrace je povolena, ale OAuth2 poskytovatel %[1]s vrátil chybějící pole: %[2]s, nelze vytvořit účet automaticky, vytvořte účet nebo se připojte k účtu, nebo kontaktujte správce webu.

options/locale/locale_de-DE.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,6 @@ oauth_signup_submit=Konto vervollständigen
452452
oauth_signin_tab=Mit existierendem Konto verbinden
453453
oauth_signin_title=Anmelden um verbundenes Konto zu autorisieren
454454
oauth_signin_submit=Konto verbinden
455-
oauth.signin.error=Beim Verarbeiten der Autorisierungsanfrage ist ein Fehler aufgetreten. Wenn dieser Fehler weiterhin besteht, wende dich bitte an deinen Administrator.
456455
oauth.signin.error.access_denied=Die Autorisierungsanfrage wurde abgelehnt.
457456
oauth.signin.error.temporarily_unavailable=Autorisierung fehlgeschlagen, da der Authentifizierungsserver vorübergehend nicht verfügbar ist. Bitte versuch es später erneut.
458457
oauth_callback_unable_auto_reg=Automatische Registrierung ist aktiviert, aber der OAuth2-Provider %[1]s hat fehlende Felder zurückgegeben: %[2]s, kann den Account nicht automatisch erstellen. Bitte erstelle oder verbinde einen Account oder kontaktieren den Administrator.

options/locale/locale_el-GR.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,6 @@ oauth_signup_submit=Ολοκληρωμένος Λογαριασμός
390390
oauth_signin_tab=Σύνδεση με υπάρχων λογαριασμό
391391
oauth_signin_title=Συνδεθείτε για να εγκρίνετε τον Συνδεδεμένο Λογαριασμό
392392
oauth_signin_submit=Σύνδεση Λογαριασμού
393-
oauth.signin.error=Παρουσιάστηκε σφάλμα κατά την επεξεργασία του αιτήματος εξουσιοδότησης. Εάν αυτό το σφάλμα επιμένει, παρακαλούμε επικοινωνήστε με το διαχειριστή του ιστοτόπου.
394393
oauth.signin.error.access_denied=Η αίτηση εξουσιοδότησης απορρίφθηκε.
395394
oauth.signin.error.temporarily_unavailable=Η εξουσιοδότηση απέτυχε επειδή ο διακομιστής ταυτοποίησης δεν είναι διαθέσιμος προσωρινά. Παρακαλώ προσπαθήστε ξανά αργότερα.
396395
openid_connect_submit=Σύνδεση

options/locale/locale_es-ES.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,6 @@ oauth_signup_submit=Completar Cuenta
387387
oauth_signin_tab=Vincular a una Cuenta Existente
388388
oauth_signin_title=Regístrese para autorizar cuenta vinculada
389389
oauth_signin_submit=Vincular Cuenta
390-
oauth.signin.error=Hubo un error al procesar la solicitud de autorización. Si este error persiste, póngase en contacto con el administrador del sitio.
391390
oauth.signin.error.access_denied=La solicitud de autorización fue denegada.
392391
oauth.signin.error.temporarily_unavailable=La autorización falló porque el servidor de autenticación no está disponible temporalmente. Inténtalo de nuevo más tarde.
393392
openid_connect_submit=Conectar

options/locale/locale_fr-FR.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,6 @@ oauth_signup_submit=Finaliser la création du compte
457457
oauth_signin_tab=Lier à un compte existant
458458
oauth_signin_title=Connectez-vous pour autoriser le compte lié
459459
oauth_signin_submit=Lier un compte
460-
oauth.signin.error=Une erreur s'est produite lors du traitement de la demande d'autorisation. Si cette erreur persiste, veuillez contacter l'administrateur du site.
461460
oauth.signin.error.access_denied=La demande d'autorisation a été refusée.
462461
oauth.signin.error.temporarily_unavailable=L'autorisation a échoué car le serveur d'authentification est temporairement indisponible. Veuillez réessayer plus tard.
463462
oauth_callback_unable_auto_reg=L’inscription automatique est activée, mais le fournisseur OAuth2 %[1]s a signalé des champs manquants : %[2]s, impossible de créer un compte automatiquement, veuillez créer ou lier un compte, ou bien contacter l’administrateur du site.

options/locale/locale_ga-IE.ini

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ copy_type_unsupported=Ní féidir an cineál comhaid seo a chóipeáil
113113
write=Scríobh
114114
preview=Réamhamharc
115115
loading=Á lódáil...
116+
files=Comhaid
116117
117118
error=Earráid
118119
error404=Níl an leathanach atá tú ag iarraidh a bhaint amach <strong>ann</strong> nó <strong>níl tú údaraithe</strong> chun é a fheiceáil.
@@ -169,6 +170,10 @@ search=Cuardaigh...
169170
type_tooltip=Cineál cuardaigh
170171
fuzzy=Doiléir
171172
fuzzy_tooltip=Cuir san áireamh torthaí a mheaitseálann an téarma cuardaigh go dlúth freisin
173+
words=Focail
174+
words_tooltip=Ná cuir san áireamh ach torthaí a mheaitseálann na focail téarma cuardaigh
175+
regexp=Nathanna Rialta
176+
regexp_tooltip=Ná cuir ach torthaí a mheaitseálann an téarma cuardaigh nathanna rialta san áireamh
172177
exact=Beacht
173178
exact_tooltip=Ní chuir san áireamh ach torthaí a mheaitseálann leis an téarma
174179
repo_kind=Cuardaigh stórtha...
@@ -452,7 +457,6 @@ oauth_signup_submit=Cuntas Comhlánaigh
452457
oauth_signin_tab=Nasc leis an gCuntas Reatha
453458
oauth_signin_title=Sínigh isteach chun Cuntas Nasctha a Údarú
454459
oauth_signin_submit=Cuntas Nasc
455-
oauth.signin.error=Bhí earráid ann ag próiseáil an t-iarratas ar údarú. Má leanann an earráid seo, déan teagmháil le riarthóir an láithreáin.
456460
oauth.signin.error.access_denied=Diúltaíodh an t-iarratas ar údarú.
457461
oauth.signin.error.temporarily_unavailable=Theip ar údarú toisc nach bhfuil an fhreastalaí fíordheimhnithe ar fáil Bain triail as arís níos déanaí.
458462
oauth_callback_unable_auto_reg=Tá Clárú Uathoibríoch cumasaithe, ach sheol Soláthraí OAuth2 %[1]s réimsí in easnamh ar ais: %[2]s, ní raibh sé in ann cuntas a chruthú go huathoibríoch, cruthaigh nó nasc le cuntas, nó déan teagmháil le riarthóir an tsuímh.
@@ -1403,6 +1407,7 @@ commits.signed_by_untrusted_user_unmatched=Sínithe ag úsáideoir neamhiontaofa
14031407
commits.gpg_key_id=GPG Eochair ID
14041408
commits.ssh_key_fingerprint=Méarloirg Eochair SSH
14051409
commits.view_path=Féach ag an bpointe seo sa stair
1410+
commits.view_file_diff=Féach ar athruithe ar an gcomhad seo sa tiomantas seo
14061411

14071412
commit.operations=Oibríochtaí
14081413
commit.revert=Téigh ar ais
@@ -1540,6 +1545,8 @@ issues.filter_project=Tionscadal
15401545
issues.filter_project_all=Gach tionscadal
15411546
issues.filter_project_none=Gan aon tionscadal
15421547
issues.filter_assignee=Sannaitheoir
1548+
issues.filter_assginee_no_assignee=Sannta do dhuine ar bith
1549+
issues.filter_assignee_any_assignee=Sannta do dhuine ar bith
15431550
issues.filter_poster=Údar
15441551
issues.filter_user_placeholder=Cuardaigh úsáideoirí
15451552
issues.filter_user_no_select=Gach úsáideoir
@@ -3706,6 +3713,7 @@ creation=Cuir Rúnda leis
37063713
creation.description=Cur síos
37073714
creation.name_placeholder=carachtair alfanumair nó íoslaghda amháin nach féidir a thosú le GITEA_ nó GITHUB_
37083715
creation.value_placeholder=Ionchur ábhar ar bith. Fágfar spás bán ag tús agus ag deireadh ar lár.
3716+
creation.description_placeholder=Cuir isteach cur síos gairid (roghnach).
37093717
creation.success=Tá an rún "%s" curtha leis.
37103718
creation.failed=Theip ar an rún a chur leis.
37113719
deletion=Bain rún

0 commit comments

Comments
 (0)