File tree Expand file tree Collapse file tree 16 files changed +83
-27
lines changed
docs/content/doc/advanced Expand file tree Collapse file tree 16 files changed +83
-27
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,8 @@ PREFIX_ARCHIVE_FILES = true
70
70
DISABLE_MIRRORS = false
71
71
; Disable migrating feature.
72
72
DISABLE_MIGRATIONS = false
73
+ ; Disable stars feature.
74
+ DISABLE_STARS = false
73
75
; The default branch name of new repositories
74
76
DEFAULT_BRANCH = master
75
77
; Allow adoption of unadopted repositories
Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
75
75
- ` PREFIX_ARCHIVE_FILES ` : ** true** : Prefix archive files by placing them in a directory named after the repository.
76
76
- ` DISABLE_MIRRORS ` : ** false** : Disable the creation of ** new** mirrors. Pre-existing mirrors remain valid.
77
77
- ` DISABLE_MIGRATIONS ` : ** false** : Disable migrating feature.
78
+ - ` DISABLE_STARS ` : ** false** : Disable stars feature.
78
79
- ` DEFAULT_BRANCH ` : ** master** : Default branch name of all repositories.
79
80
- ` ALLOW_ADOPTION_OF_UNADOPTED_REPOSITORIES ` : ** false** : Allow non-admin users to adopt unadopted repositories
80
81
- ` ALLOW_DELETION_OF_UNADOPTED_REPOSITORIES ` : ** false** : Allow non-admin users to delete unadopted repositories
Original file line number Diff line number Diff line change @@ -143,6 +143,7 @@ type SearchRepoOptions struct {
143
143
OrderBy SearchOrderBy
144
144
Private bool // Include private repositories in results
145
145
StarredByID int64
146
+ WatchedByID int64
146
147
AllPublic bool // Include also all public repositories of users and public organisations
147
148
AllLimited bool // Include also all public repositories of limited organisations
148
149
// None -> include public and private
@@ -241,6 +242,11 @@ func SearchRepositoryCondition(opts *SearchRepoOptions) builder.Cond {
241
242
cond = cond .And (builder .In ("id" , builder .Select ("repo_id" ).From ("star" ).Where (builder.Eq {"uid" : opts .StarredByID })))
242
243
}
243
244
245
+ // Restrict to watched repositories
246
+ if opts .WatchedByID > 0 {
247
+ cond = cond .And (builder .In ("id" , builder .Select ("repo_id" ).From ("watch" ).Where (builder.Eq {"user_id" : opts .WatchedByID })))
248
+ }
249
+
244
250
// Restrict repositories to those the OwnerID owns or contributes to as per opts.Collaborate
245
251
if opts .OwnerID > 0 {
246
252
accessCond := builder .NewCond ()
Original file line number Diff line number Diff line change @@ -704,6 +704,7 @@ func Contexter() func(next http.Handler) http.Handler {
704
704
ctx .Data ["EnableSwagger" ] = setting .API .EnableSwagger
705
705
ctx .Data ["EnableOpenIDSignIn" ] = setting .Service .EnableOpenIDSignIn
706
706
ctx .Data ["DisableMigrations" ] = setting .Repository .DisableMigrations
707
+ ctx .Data ["DisableStars" ] = setting .Repository .DisableStars
707
708
708
709
ctx .Data ["ManifestData" ] = setting .ManifestData
709
710
Original file line number Diff line number Diff line change 43
43
PrefixArchiveFiles bool
44
44
DisableMirrors bool
45
45
DisableMigrations bool
46
+ DisableStars bool `ini:"DISABLE_STARS"`
46
47
DefaultBranch string
47
48
AllowAdoptionOfUnadoptedRepositories bool
48
49
AllowDeleteOfUnadoptedRepositories bool
@@ -154,6 +155,7 @@ var (
154
155
PrefixArchiveFiles : true ,
155
156
DisableMirrors : false ,
156
157
DisableMigrations : false ,
158
+ DisableStars : false ,
157
159
DefaultBranch : "master" ,
158
160
159
161
// Repository editor settings
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ type GeneralRepoSettings struct {
9
9
MirrorsDisabled bool `json:"mirrors_disabled"`
10
10
HTTPGitDisabled bool `json:"http_git_disabled"`
11
11
MigrationsDisabled bool `json:"migrations_disabled"`
12
+ StarsDisabled bool `json:"stars_disabled"`
12
13
TimeTrackingDisabled bool `json:"time_tracking_disabled"`
13
14
LFSDisabled bool `json:"lfs_disabled"`
14
15
}
Original file line number Diff line number Diff line change @@ -421,6 +421,7 @@ repositories = Repositories
421
421
activity = Public Activity
422
422
followers = Followers
423
423
starred = Starred Repositories
424
+ watched = Watched Repositories
424
425
projects = Projects
425
426
following = Following
426
427
follow = Follow
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ func GetGeneralRepoSettings(ctx *context.APIContext) {
60
60
MirrorsDisabled : setting .Repository .DisableMirrors ,
61
61
HTTPGitDisabled : setting .Repository .DisableHTTPGit ,
62
62
MigrationsDisabled : setting .Repository .DisableMigrations ,
63
+ StarsDisabled : setting .Repository .DisableStars ,
63
64
TimeTrackingDisabled : ! setting .Service .EnableTimetracking ,
64
65
LFSDisabled : ! setting .LFS .StartServer ,
65
66
})
Original file line number Diff line number Diff line change @@ -238,6 +238,27 @@ func Profile(ctx *context.Context) {
238
238
ctx .ServerError ("GetProjects" , err )
239
239
return
240
240
}
241
+ case "watching" :
242
+ repos , count , err = models .SearchRepository (& models.SearchRepoOptions {
243
+ ListOptions : models.ListOptions {
244
+ PageSize : setting .UI .User .RepoPagingNum ,
245
+ Page : page ,
246
+ },
247
+ Actor : ctx .User ,
248
+ Keyword : keyword ,
249
+ OrderBy : orderBy ,
250
+ Private : ctx .IsSigned ,
251
+ WatchedByID : ctxUser .ID ,
252
+ Collaborate : util .OptionalBoolFalse ,
253
+ TopicOnly : topicOnly ,
254
+ IncludeDescription : setting .UI .SearchRepoDescription ,
255
+ })
256
+ if err != nil {
257
+ ctx .ServerError ("SearchRepository" , err )
258
+ return
259
+ }
260
+
261
+ total = int (count )
241
262
default :
242
263
repos , count , err = models .SearchRepository (& models.SearchRepoOptions {
243
264
ListOptions : models.ListOptions {
Original file line number Diff line number Diff line change 157
157
{{svg "octicon-person"}}
158
158
{{.i18n.Tr "your_profile"}}<!-- Your profile -->
159
159
</a>
160
- <a class="item" href="{{AppSubUrl}}/{{.SignedUser.Name}}?tab=stars">
161
- {{svg "octicon-star"}}
162
- {{.i18n.Tr "your_starred"}}
163
- </a>
160
+ {{if not .DisableStars}}
161
+ <a class="item" href="{{AppSubUrl}}/{{.SignedUser.Name}}?tab=stars">
162
+ {{svg "octicon-star"}}
163
+ {{.i18n.Tr "your_starred"}}
164
+ </a>
165
+ {{end}}
164
166
<a class="{{if .PageIsUserSettings}}active{{end}} item" href="{{AppSubUrl}}/user/settings">
165
167
{{svg "octicon-tools"}}
166
168
{{.i18n.Tr "your_settings"}}<!-- Your settings -->
Original file line number Diff line number Diff line change 42
42
{{if .PrimaryLanguage }}
43
43
<span class="text grey df ac mr-3"><i class="color-icon mr-3" style="background-color: {{.PrimaryLanguage.Color}}"></i>{{ .PrimaryLanguage.Language }}</span>
44
44
{{end}}
45
- <span class="text grey df ac mr-3">{{svg "octicon-star" 16 "mr-3"}}{{.NumStars}}</span>
45
+ {{if not $.DisableStars}}
46
+ <span class="text grey df ac mr-3">{{svg "octicon-star" 16 "mr-3"}}{{.NumStars}}</span>
47
+ {{end}}
46
48
<span class="text grey df ac mr-3">{{svg "octicon-git-branch" 16 "mr-3"}}{{.NumForks}}</span>
47
49
</div>
48
50
</div>
Original file line number Diff line number Diff line change 12
12
<a class="{{if eq .SortType "reversealphabetically"}}active{{end}} item" href="{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a>
13
13
<a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a>
14
14
<a class="{{if eq .SortType "leastupdate"}}active{{end}} item" href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a>
15
- <a class="{{if eq .SortType "moststars"}}active{{end}} item" href="{{$.Link}}?sort=moststars&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.moststars"}}</a>
16
- <a class="{{if eq .SortType "feweststars"}}active{{end}} item" href="{{$.Link}}?sort=feweststars&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.feweststars"}}</a>
15
+ {{if not .DisableStars}}
16
+ <a class="{{if eq .SortType "moststars"}}active{{end}} item" href="{{$.Link}}?sort=moststars&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.moststars"}}</a>
17
+ <a class="{{if eq .SortType "feweststars"}}active{{end}} item" href="{{$.Link}}?sort=feweststars&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.feweststars"}}</a>
18
+ {{end}}
17
19
<a class="{{if eq .SortType "mostforks"}}active{{end}} item" href="{{$.Link}}?sort=mostforks&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.mostforks"}}</a>
18
20
<a class="{{if eq .SortType "fewestforks"}}active{{end}} item" href="{{$.Link}}?sort=fewestforks&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.fewestforks"}}</a>
19
21
</div>
Original file line number Diff line number Diff line change 71
71
</a>
72
72
</div>
73
73
</form>
74
- <form method="post" action="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}">
75
- {{$.CsrfTokenHtml}}
76
- <div class="ui labeled button{{if not $.IsSigned}} poping up{{end}}" tabindex="0"{{if not $.IsSigned}} data-content="{{$.i18n.Tr "repo.star_guest_user" }}" data-position="top center" data-variation="tiny"{{end}}>
77
- <button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}}>
78
- {{if $.IsStaringRepo}}{{svg "octicon-star-fill"}}{{$.i18n.Tr "repo.unstar"}}{{else}}{{svg "octicon-star"}}{{$.i18n.Tr "repo.star"}}{{end}}
79
- </button>
80
- <a class="ui basic label" href="{{.Link}}/stars">
81
- {{CountFmt .NumStars}}
82
- </a>
83
- </div>
84
- </form>
74
+ {{if not $.DisableStars}}
75
+ <form method="post" action="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}">
76
+ {{$.CsrfTokenHtml}}
77
+ <div class="ui labeled button{{if not $.IsSigned}} poping up{{end}}" tabindex="0"{{if not $.IsSigned}} data-content="{{$.i18n.Tr "repo.star_guest_user" }}" data-position="top center" data-variation="tiny"{{end}}>
78
+ <button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}}>
79
+ {{if $.IsStaringRepo}}{{svg "octicon-star-fill"}}{{$.i18n.Tr "repo.unstar"}}{{else}}{{svg "octicon-star"}}{{$.i18n.Tr "repo.star"}}{{end}}
80
+ </button>
81
+ <a class="ui basic label" href="{{.Link}}/stars">
82
+ {{CountFmt .NumStars}}
83
+ </a>
84
+ </div>
85
+ </form>
86
+ {{end}}
85
87
{{if and (not .IsEmpty) ($.Permission.CanRead $.UnitTypeCode)}}
86
88
<div class="ui labeled button{{if not $.CanSignedUserFork}} poping up disabled{{end}}"{{if and (not $.CanSignedUserFork) $.IsSigned}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" {{else if not $.IsSigned}} data-content="{{$.i18n.Tr "repo.fork_guest_user"}}"{{end}} data-position="top center" data-variation="tiny" tabindex="0">
87
89
<a class="ui compact small basic button"{{if $.CanSignedUserFork}} href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{end}}>
Original file line number Diff line number Diff line change 14151
14151
"type": "boolean",
14152
14152
"x-go-name": "MirrorsDisabled"
14153
14153
},
14154
+ "stars_disabled": {
14155
+ "type": "boolean",
14156
+ "x-go-name": "StarsDisabled"
14157
+ },
14154
14158
"time_tracking_disabled": {
14155
14159
"type": "boolean",
14156
14160
"x-go-name": "TimeTrackingDisabled"
Original file line number Diff line number Diff line change 130
130
{{svg "octicon-archive" 16 "ml-2"}}
131
131
</span>
132
132
</div>
133
- <div class="text light grey df ac">
134
- ${repo.stars_count}
135
- {{svg "octicon-star" 16 "ml-2"}}
136
- </div>
133
+ {{if not .DisableStars}}
134
+ <div class="text light grey df ac">
135
+ ${repo.stars_count}
136
+ {{svg "octicon-star" 16 "ml-2"}}
137
+ </div>
138
+ {{end}}
137
139
</a>
138
140
</li>
139
141
</ul>
Original file line number Diff line number Diff line change 84
84
</div>
85
85
<div class="ui eleven wide column">
86
86
<div class="ui secondary stackable pointing tight menu">
87
- <a class='{{if and (ne .TabName "activity") (ne .TabName "following") (ne .TabName "followers") (ne .TabName "stars") (ne .TabName "projects")}}active{{end}} item' href="{{.Owner.HomeLink}}">
87
+ <a class='{{if and (ne .TabName "activity") (ne .TabName "following") (ne .TabName "followers") (ne .TabName "stars") (ne .TabName "watching") (ne .TabName " projects")}}active{{end}} item' href="{{.Owner.HomeLink}}">
88
88
{{svg "octicon-repo"}} {{.i18n.Tr "user.repositories"}}
89
89
</a>
90
90
<a class='{{if eq .TabName "activity"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=activity">
91
91
{{svg "octicon-rss"}} {{.i18n.Tr "user.activity"}}
92
92
</a>
93
- <a class='{{if eq .TabName "stars"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=stars">
94
- {{svg "octicon-star"}} {{.i18n.Tr "user.starred"}}
95
- <div class="ui label">{{.Owner.NumStars}}</div>
96
- </a>
93
+ {{if not .DisableStars}}
94
+ <a class='{{if eq .TabName "stars"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=stars">
95
+ {{svg "octicon-star"}} {{.i18n.Tr "user.starred"}}
96
+ <div class="ui label">{{.Owner.NumStars}}</div>
97
+ </a>
98
+ {{else}}
99
+ <a class='{{if eq .TabName "watching"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=watching">
100
+ {{svg "octicon-eye"}} {{.i18n.Tr "user.watched"}}
101
+ </a>
102
+ {{end}}
97
103
<a class='{{if eq .TabName "following"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=following">
98
104
{{svg "octicon-person"}} {{.i18n.Tr "user.following"}}
99
105
<div class="ui label">{{.Owner.NumFollowing}}</div>
You can’t perform that action at this time.
0 commit comments