refactor: reuse the existing service and rendering helpers

services.IsNotFound replaces the hand-rolled 404 checks, convertPage
the copied page conversions and lastPathNumber the comment's own
number parser. The List wrappers around ListPage of releases,
branches, wiki pages, secrets and variables go, pull request filters
resolve milestones through Milestones.FindOne like issues, and
localFlagsChanged, boolOrder, Cell.Render, stateBadge and dueText
replace their copies.

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-12 11:22:52 +02:00
1 parent 29f62da006
commit 83924892ff
33 files changed
+85 -212

No files matched your search

+2 -8
View File
@@ -55,13 +55,7 @@ type Releases struct {
func (s Releases) endpoint() string { return "repos/" + s.Repository + "/releases" }
// List returns a non-nil page of releases.
func (s Releases) List(ctx context.Context, limit, page int) ([]Release, error) {
window, err := s.ListPage(ctx, limit, page)
return window.Items, err
}
// ListPage is List that also reports whether more releases follow and how many there are.
// ListPage lists a page of releases, with whether more follow and how many there are.
func (s Releases) ListPage(ctx context.Context, limit, page int) (Page[Release], error) {
window, err := listPage(limit, page, func(limit, page int) ([]*gitea.Release, http.Header, error) {
var headers http.Header
@@ -75,7 +69,7 @@ func (s Releases) ListPage(ctx context.Context, limit, page int) (Page[Release],
if err != nil {
return Page[Release]{}, err
}
return Page[Release]{Items: convertAll(window.Items, releaseFrom), More: window.More, Total: window.Total, Counted: window.Counted}, nil
return convertPage(window, releaseFrom), nil
}
// View retrieves a release by its tag, including numeric tags.