mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01: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
@@ -194,6 +194,12 @@ func Classify(err error, kind, key, scope string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// IsNotFound reports whether err is a 404 response.
|
||||
func IsNotFound(err error) bool {
|
||||
failure, ok := errors.AsType[*transport.APIError](err)
|
||||
return ok && failure.Status == http.StatusNotFound
|
||||
}
|
||||
|
||||
// refusal returns the conflict reason of a refused request, or "".
|
||||
func refusal(apiErr *transport.APIError) string {
|
||||
if apiErr.Status == http.StatusLocked {
|
||||
|
||||
Reference in new issue
Block a user