Skip to content

Commit 12e3fc3

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Drop `IDOrderDesc` for listing Actions task and always order by `id DESC` (go-gitea#31150) Fix branch order (go-gitea#31174)
2 parents c74b94c + 572fa55 commit 12e3fc3

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

models/actions/task_list.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ type FindTaskOptions struct {
5454
UpdatedBefore timeutil.TimeStamp
5555
StartedBefore timeutil.TimeStamp
5656
RunnerID int64
57-
IDOrderDesc bool
5857
}
5958

6059
func (opts FindTaskOptions) ToConds() builder.Cond {
@@ -84,8 +83,5 @@ func (opts FindTaskOptions) ToConds() builder.Cond {
8483
}
8584

8685
func (opts FindTaskOptions) ToOrders() string {
87-
if opts.IDOrderDesc {
88-
return "`id` DESC"
89-
}
90-
return ""
86+
return "`id` DESC"
9187
}

models/git/branch_list.go

+4-8
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,13 @@ func (opts FindBranchOptions) ToConds() builder.Cond {
107107

108108
func (opts FindBranchOptions) ToOrders() string {
109109
orderBy := opts.OrderBy
110-
if opts.IsDeletedBranch.ValueOrDefault(true) { // if deleted branch included, put them at the end
111-
if orderBy != "" {
112-
orderBy += ", "
113-
}
114-
orderBy += "is_deleted ASC"
115-
}
116110
if orderBy == "" {
117111
// the commit_time might be the same, so add the "name" to make sure the order is stable
118-
return "commit_time DESC, name ASC"
112+
orderBy = "commit_time DESC, name ASC"
113+
}
114+
if opts.IsDeletedBranch.ValueOrDefault(true) { // if deleted branch included, put them at the beginning
115+
orderBy = "is_deleted ASC, " + orderBy
119116
}
120-
121117
return orderBy
122118
}
123119

routers/web/shared/actions/runners.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,8 @@ func RunnerDetails(ctx *context.Context, page int, runnerID, ownerID, repoID int
7979
Page: page,
8080
PageSize: 30,
8181
},
82-
Status: actions_model.StatusUnknown, // Unknown means all
83-
IDOrderDesc: true,
84-
RunnerID: runner.ID,
82+
Status: actions_model.StatusUnknown, // Unknown means all
83+
RunnerID: runner.ID,
8584
}
8685

8786
tasks, count, err := db.FindAndCount[actions_model.ActionTask](ctx, opts)

0 commit comments

Comments
 (0)