Skip to content

Commit 3f02ca1

Browse files
committed
fix
1 parent 99d0510 commit 3f02ca1

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

models/admin/task.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import (
1717
"code.gitea.io/gitea/modules/structs"
1818
"code.gitea.io/gitea/modules/timeutil"
1919
"code.gitea.io/gitea/modules/util"
20+
21+
"xorm.io/builder"
2022
)
2123

2224
// Task represents a task
@@ -181,12 +183,8 @@ func GetMigratingTask(ctx context.Context, repoID int64) (*Task, error) {
181183

182184
// GetMigratingTaskByID returns the migrating task by repo's id
183185
func GetMigratingTaskByID(ctx context.Context, id, doerID int64) (*Task, *migration.MigrateOptions, error) {
184-
task := Task{
185-
ID: id,
186-
DoerID: doerID,
187-
Type: structs.TaskTypeMigrateRepo,
188-
}
189-
has, err := db.GetEngine(ctx).Get(&task)
186+
task := Task{}
187+
has, err := db.GetEngine(ctx).Where(builder.Eq{"id": id, "doer_id": doerID, "`type`": structs.TaskTypeMigrateRepo}).Get(&task)
190188
if err != nil {
191189
return nil, nil, err
192190
} else if !has {

0 commit comments

Comments
 (0)