Skip to content

Commit 66a1c59

Browse files
author
Avelino
committed
UI config to toggle whether user email shows up in Explore Users
1 parent 5ab8537 commit 66a1c59

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

conf/app.ini

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ FEED_MAX_COMMIT_NUM = 5
6060
THEME_COLOR_META_TAG = `#ff5343`
6161
; Max size of files to be displayed (defaults is 8MiB)
6262
MAX_DISPLAY_FILE_SIZE = 8388608
63+
; Whether show the user email in the Explore Users page
64+
SHOW_USER_EMAIL_IN_EXPLORE = true
6365

6466
[ui.admin]
6567
; Number of users that are showed in one page

modules/setting/setting.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,12 @@ var (
147147

148148
// UI settings
149149
UI struct {
150-
ExplorePagingNum int
151-
IssuePagingNum int
152-
FeedMaxCommitNum int
153-
ThemeColorMetaTag string
154-
MaxDisplayFileSize int64
150+
ExplorePagingNum int
151+
IssuePagingNum int
152+
FeedMaxCommitNum int
153+
ThemeColorMetaTag string
154+
MaxDisplayFileSize int64
155+
ShowUserEmailInExplore bool
155156

156157
Admin struct {
157158
UserPagingNum int
@@ -601,6 +602,8 @@ please consider changing to GITEA_CUSTOM`)
601602
ShowFooterVersion = Cfg.Section("other").Key("SHOW_FOOTER_VERSION").MustBool()
602603
ShowFooterTemplateLoadTime = Cfg.Section("other").Key("SHOW_FOOTER_TEMPLATE_LOAD_TIME").MustBool()
603604

605+
UI.ShowUserEmailInExplore = Cfg.Section("ui").Key("SHOW_USER_EMAIL_IN_EXPLORE").MustBool()
606+
604607
HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt"))
605608
}
606609

routers/home.go

+1
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ func RenderUserSearch(ctx *context.Context, opts *UserSearchOptions) {
186186
ctx.Data["Total"] = count
187187
ctx.Data["Page"] = paginater.New(int(count), opts.PageSize, page, 5)
188188
ctx.Data["Users"] = users
189+
ctx.Data["ShowUserEmail"] = setting.UI.ShowUserEmailInExplore
189190

190191
ctx.HTML(200, opts.TplName)
191192
}

templates/explore/users.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{{if .Location}}
1717
<i class="octicon octicon-location"></i> {{.Location}}
1818
{{end}}
19-
{{if and .Email $.IsSigned}}
19+
{{if and $.ShowUserEmail .Email $.IsSigned}}
2020
<i class="octicon octicon-mail"></i>
2121
<a href="mailto:{{.Email}}" rel="nofollow">{{.Email}}</a>
2222
{{end}}

0 commit comments

Comments
 (0)