mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11:25 +01:00
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:
33 files changed
+85
-212
No files matched your search
@@ -224,7 +224,7 @@ func (s Pulls) listPage(ctx context.Context, options PullListOptions) (Page[Pull
|
||||
if err != nil {
|
||||
return Page[Pull]{}, err
|
||||
}
|
||||
return Page[Pull]{Items: convertAll(page.Items, pullFrom), More: page.More, Total: page.Total, Counted: page.Counted}, nil
|
||||
return convertPage(page, pullFrom), nil
|
||||
}
|
||||
|
||||
// View retrieves one pull request.
|
||||
@@ -476,7 +476,7 @@ func (s Pulls) Template(ctx context.Context, ref string) (string, error) {
|
||||
return c.Repositories.GetFileReader(ctx, owner, name, ref, path)
|
||||
})
|
||||
if err != nil {
|
||||
if apiError, ok := errors.AsType[*transport.APIError](err); ok && apiError.Status == http.StatusNotFound {
|
||||
if IsNotFound(err) {
|
||||
continue
|
||||
}
|
||||
return "", err
|
||||
|
||||
Reference in new issue
Block a user