Skip to content

Commit 645f58b

Browse files
committed
fix: Actor is required to get user repositories
1 parent c0f5111 commit 645f58b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

models/repo/repo_list.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package repo
66

77
import (
88
"context"
9+
"errors"
910
"fmt"
1011
"strings"
1112

@@ -695,6 +696,9 @@ func GetUserRepositories(opts *SearchRepoOptions) (RepositoryList, int64, error)
695696
}
696697

697698
cond := builder.NewCond()
699+
if opts.Actor == nil {
700+
return nil, 0, errors.New("GetUserRepositories: Actor is needed but not given")
701+
}
698702
cond = cond.And(builder.Eq{"owner_id": opts.Actor.ID})
699703
if !opts.Private {
700704
cond = cond.And(builder.Eq{"is_private": false})

services/user/user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func DeleteUser(ctx context.Context, u *user_model.User, purge bool) error {
7474
Page: 1,
7575
},
7676
Private: true,
77-
OwnerID: u.ID,
77+
Actor: u,
7878
})
7979
if err != nil {
8080
return fmt.Errorf("SearchRepositoryByName: %v", err)

0 commit comments

Comments
 (0)