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
+1
-11
@@ -463,7 +463,7 @@ $ tea auth status --host gitea.com --json`,
|
||||
rows = append(rows, row)
|
||||
}
|
||||
slices.SortFunc(rows, func(x, y authStatusRow) int {
|
||||
return cmp.Or(strings.Compare(x.Host, y.Host), -compareBool(x.environment(), y.environment()), strings.Compare(x.User, y.User))
|
||||
return cmp.Or(strings.Compare(x.Host, y.Host), cmp.Compare(boolOrder(y.environment()), boolOrder(x.environment())), strings.Compare(x.User, y.User))
|
||||
})
|
||||
if a.options.json != "" {
|
||||
return a.writeJSON(cmd, rows)
|
||||
@@ -487,16 +487,6 @@ $ tea auth status --host gitea.com --json`,
|
||||
return status
|
||||
}
|
||||
|
||||
func compareBool(x, y bool) int {
|
||||
switch {
|
||||
case x == y:
|
||||
return 0
|
||||
case x:
|
||||
return 1
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
// accountStatus reports a stored account without revealing its credential.
|
||||
func (a *application) accountStatus(ctx context.Context, s settings.Snapshot, instance, user string, verify bool) authStatusRow {
|
||||
host := s.Hosts.Hosts[instance]
|
||||
|
||||
Reference in new issue
Block a user