diff options
Diffstat (limited to 'models/repo_list.go')
-rw-r--r-- | models/repo_list.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/models/repo_list.go b/models/repo_list.go index 74bc256190..b4a6d9e438 100644 --- a/models/repo_list.go +++ b/models/repo_list.go @@ -143,6 +143,7 @@ type SearchRepoOptions struct { OrderBy SearchOrderBy Private bool // Include private repositories in results StarredByID int64 + WatchedByID int64 AllPublic bool // Include also all public repositories of users and public organisations AllLimited bool // Include also all public repositories of limited organisations // None -> include public and private @@ -241,6 +242,11 @@ func SearchRepositoryCondition(opts *SearchRepoOptions) builder.Cond { cond = cond.And(builder.In("id", builder.Select("repo_id").From("star").Where(builder.Eq{"uid": opts.StarredByID}))) } + // Restrict to watched repositories + if opts.WatchedByID > 0 { + cond = cond.And(builder.In("id", builder.Select("repo_id").From("watch").Where(builder.Eq{"user_id": opts.WatchedByID}))) + } + // Restrict repositories to those the OwnerID owns or contributes to as per opts.Collaborate if opts.OwnerID > 0 { accessCond := builder.NewCond() |