Skip to content

Commit

Permalink
fix: Actor is required to get user repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvmanila committed Jul 21, 2022
1 parent c0f5111 commit 645f58b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions models/repo/repo_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package repo

import (
"context"
"errors"
"fmt"
"strings"

Expand Down Expand Up @@ -695,6 +696,9 @@ func GetUserRepositories(opts *SearchRepoOptions) (RepositoryList, int64, error)
}

cond := builder.NewCond()
if opts.Actor == nil {
return nil, 0, errors.New("GetUserRepositories: Actor is needed but not given")
}
cond = cond.And(builder.Eq{"owner_id": opts.Actor.ID})
if !opts.Private {
cond = cond.And(builder.Eq{"is_private": false})
Expand Down
2 changes: 1 addition & 1 deletion services/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func DeleteUser(ctx context.Context, u *user_model.User, purge bool) error {
Page: 1,
},
Private: true,
OwnerID: u.ID,
Actor: u,
})
if err != nil {
return fmt.Errorf("SearchRepositoryByName: %v", err)
Expand Down

0 comments on commit 645f58b

Please sign in to comment.