File tree Expand file tree Collapse file tree 10 files changed +45
-26
lines changed Expand file tree Collapse file tree 10 files changed +45
-26
lines changed Original file line number Diff line number Diff line change @@ -712,6 +712,7 @@ func Contexter() func(next http.Handler) http.Handler {
712
712
ctx .Data ["EnableSwagger" ] = setting .API .EnableSwagger
713
713
ctx .Data ["EnableOpenIDSignIn" ] = setting .Service .EnableOpenIDSignIn
714
714
ctx .Data ["DisableMigrations" ] = setting .Repository .DisableMigrations
715
+ ctx .Data ["DisableStars" ] = setting .Repository .DisableStars
715
716
716
717
ctx .Data ["ManifestData" ] = setting .ManifestData
717
718
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 @@ -6,9 +6,10 @@ package structs
6
6
7
7
// GeneralRepoSettings contains global repository settings exposed by API
8
8
type GeneralRepoSettings struct {
9
- MirrorsDisabled bool `json:"mirrors_disabled"`
10
- HTTPGitDisabled bool `json:"http_git_disabled"`
11
- MigrationsDisabled bool `json:"migrations_disabled"`
9
+ MirrorsDisabled bool `json:"mirrors_disabled"`
10
+ HTTPGitDisabled bool `json:"http_git_disabled"`
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 @@ -57,9 +57,10 @@ func GetGeneralRepoSettings(ctx *context.APIContext) {
57
57
// "200":
58
58
// "$ref": "#/responses/GeneralRepoSettings"
59
59
ctx .JSON (http .StatusOK , api.GeneralRepoSettings {
60
- MirrorsDisabled : setting .Repository .DisableMirrors ,
61
- HTTPGitDisabled : setting .Repository .DisableHTTPGit ,
62
- MigrationsDisabled : setting .Repository .DisableMigrations ,
60
+ MirrorsDisabled : setting .Repository .DisableMirrors ,
61
+ HTTPGitDisabled : setting .Repository .DisableHTTPGit ,
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 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
+ {{if not .DisableStars}}
15
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>
16
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 53
53
</a>
54
54
</div>
55
55
</form>
56
- <form method="post" action="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}">
57
- {{$.CsrfTokenHtml}}
58
- <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}}>
59
- <button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}}>
60
- {{if $.IsStaringRepo}}{{svg "octicon-star-fill"}}{{$.i18n.Tr "repo.unstar"}}{{else}}{{svg "octicon-star"}}{{$.i18n.Tr "repo.star"}}{{end}}
61
- </button>
62
- <a class="ui basic label" href="{{.Link}}/stars">
63
- {{CountFmt .NumStars}}
64
- </a>
65
- </div>
66
- </form>
56
+ {{if not $.DisableStars}}
57
+ <form method="post" action="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}">
58
+ {{$.CsrfTokenHtml}}
59
+ <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}}>
60
+ <button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}}>
61
+ {{if $.IsStaringRepo}}{{svg "octicon-star-fill"}}{{$.i18n.Tr "repo.unstar"}}{{else}}{{svg "octicon-star"}}{{$.i18n.Tr "repo.star"}}{{end}}
62
+ </button>
63
+ <a class="ui basic label" href="{{.Link}}/stars">
64
+ {{CountFmt .NumStars}}
65
+ </a>
66
+ </div>
67
+ </form>
68
+ {{end}}
67
69
{{if and (not .IsEmpty) ($.Permission.CanRead $.UnitTypeCode)}}
68
70
<div class="ui labeled button" tabindex="0">
69
71
<a class="ui compact small basic button {{if or (not $.IsSigned) (not $.CanSignedUserFork)}}poping up{{end}}" {{if $.CanSignedUserFork}}href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{else if $.IsSigned}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" {{ else }} data-content="{{$.i18n.Tr "repo.fork_guest_user" }}" rel="nofollow" href="{{AppSubUrl}}/user/login?redirect_to={{AppSubUrl}}/repo/fork/{{.ID}}" {{end}} data-position="top center" data-variation="tiny">
Original file line number Diff line number Diff line change 14113
14113
"type": "boolean",
14114
14114
"x-go-name": "MirrorsDisabled"
14115
14115
},
14116
+ "stars_disabled": {
14117
+ "type": "boolean",
14118
+ "x-go-name": "StarsDisabled"
14119
+ },
14116
14120
"time_tracking_disabled": {
14117
14121
"type": "boolean",
14118
14122
"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>
You can’t perform that action at this time.
0 commit comments