summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorKyle D <kdumontnu@gmail.com>2021-04-15 10:53:57 -0600
committerGitHub <noreply@github.com>2021-04-15 18:53:57 +0200
commitf44543a1bb776fa8bdfd3b605d67197d1466eb20 (patch)
treeb9a014285b40c3eb45dd90bcafa7ccc17c1031d8 /models
parentaf2adb4e35ea71ca5c7fbb1e51b9d25fe49af2e4 (diff)
downloadgitea-f44543a1bb776fa8bdfd3b605d67197d1466eb20.tar.gz
gitea-f44543a1bb776fa8bdfd3b605d67197d1466eb20.zip
Disable Stars config option (#14653)
* Add config option to disable stars * Replace "stars" with watched in user profile * Add documentation
Diffstat (limited to 'models')
-rw-r--r--models/repo_list.go6
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()