Disable Stars config option (#14653)

* Add config option to disable stars

* Replace "stars" with watched in user profile

* Add documentation
This commit is contained in:
Kyle D 2021-04-15 10:53:57 -06:00 committed by GitHub
parent af2adb4e35
commit f44543a1bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 83 additions and 27 deletions

View file

@ -60,6 +60,7 @@ func GetGeneralRepoSettings(ctx *context.APIContext) {
MirrorsDisabled: setting.Repository.DisableMirrors,
HTTPGitDisabled: setting.Repository.DisableHTTPGit,
MigrationsDisabled: setting.Repository.DisableMigrations,
StarsDisabled: setting.Repository.DisableStars,
TimeTrackingDisabled: !setting.Service.EnableTimetracking,
LFSDisabled: !setting.LFS.StartServer,
})

View file

@ -238,6 +238,27 @@ func Profile(ctx *context.Context) {
ctx.ServerError("GetProjects", err)
return
}
case "watching":
repos, count, err = models.SearchRepository(&models.SearchRepoOptions{
ListOptions: models.ListOptions{
PageSize: setting.UI.User.RepoPagingNum,
Page: page,
},
Actor: ctx.User,
Keyword: keyword,
OrderBy: orderBy,
Private: ctx.IsSigned,
WatchedByID: ctxUser.ID,
Collaborate: util.OptionalBoolFalse,
TopicOnly: topicOnly,
IncludeDescription: setting.UI.SearchRepoDescription,
})
if err != nil {
ctx.ServerError("SearchRepository", err)
return
}
total = int(count)
default:
repos, count, err = models.SearchRepository(&models.SearchRepoOptions{
ListOptions: models.ListOptions{