mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-26 16:03:38 +00:00
fix(db): make paginated database reads always require "order" option (#39017)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -40,8 +40,7 @@ func (source *Source) Sync(ctx context.Context, updateExisting bool) error {
|
||||
Expired: true,
|
||||
LoginSourceID: source.AuthSource.ID,
|
||||
}
|
||||
|
||||
return user_model.IterateExternalLogin(ctx, opts, func(ctx context.Context, u *user_model.ExternalLoginUser) error {
|
||||
return db.IterateByColumn(ctx, "external_id", opts.ToConds(), func(ctx context.Context, u *user_model.ExternalLoginUser) error {
|
||||
return source.refresh(ctx, provider, u)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ func TestRepoActions(t *testing.T) {
|
||||
OpType: activities_model.ActionCommentIssue,
|
||||
})
|
||||
}
|
||||
count, _ := db.Count[activities_model.Action](t.Context(), &db.ListOptions{})
|
||||
count, _ := db.Count[activities_model.Action](t.Context(), nil)
|
||||
assert.EqualValues(t, 3, count)
|
||||
actions, _, err := GetFeeds(t.Context(), activities_model.GetFeedsOptions{
|
||||
RequestedRepo: repo,
|
||||
|
||||
@@ -237,6 +237,10 @@ type findForksOptions struct {
|
||||
Doer *user_model.User
|
||||
}
|
||||
|
||||
func (opts findForksOptions) ToOrders() string {
|
||||
return "id"
|
||||
}
|
||||
|
||||
func (opts findForksOptions) ToConds() builder.Cond {
|
||||
cond := builder.Eq{"fork_id": opts.RepoID}
|
||||
if opts.Doer != nil && opts.Doer.IsAdmin {
|
||||
|
||||
Reference in New Issue
Block a user