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
@@ -8,7 +8,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
@@ -18,7 +17,6 @@ import (
|
||||
"gitea.dev/tea/internal/clierr"
|
||||
"gitea.dev/tea/internal/services"
|
||||
"gitea.dev/tea/internal/terminal"
|
||||
"gitea.dev/tea/internal/transport"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@@ -490,7 +488,7 @@ func issueLabel(n int64) string { return fmt.Sprintf("issue %d", n) }
|
||||
// itemError words the failure of one item of a batch, which the batch prefixes with the item, such
|
||||
// as "issue 9: not found in alice/x".
|
||||
func itemError(err error, scope string) error {
|
||||
if apiErr, ok := errors.AsType[*transport.APIError](err); ok && apiErr.Status == http.StatusNotFound {
|
||||
if services.IsNotFound(err) {
|
||||
return explain(err, "not found in %s", scope)
|
||||
}
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user