diff --git a/conf/app.ini b/conf/app.ini
index dfc8ae20fce0c..22dc06e0ef228 100644
--- a/conf/app.ini
+++ b/conf/app.ini
@@ -60,6 +60,8 @@ FEED_MAX_COMMIT_NUM = 5
THEME_COLOR_META_TAG = `#ff5343`
; Max size of files to be displayed (defaults is 8MiB)
MAX_DISPLAY_FILE_SIZE = 8388608
+; Whether show the user email in the Explore Users page
+SHOW_USER_EMAIL_IN_EXPLORE = true
[ui.admin]
; Number of users that are showed in one page
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 2ee8ce94d71f0..85e089bbac9be 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -147,11 +147,12 @@ var (
// UI settings
UI struct {
- ExplorePagingNum int
- IssuePagingNum int
- FeedMaxCommitNum int
- ThemeColorMetaTag string
- MaxDisplayFileSize int64
+ ExplorePagingNum int
+ IssuePagingNum int
+ FeedMaxCommitNum int
+ ThemeColorMetaTag string
+ MaxDisplayFileSize int64
+ ShowUserEmailInExplore bool
Admin struct {
UserPagingNum int
@@ -601,6 +602,8 @@ please consider changing to GITEA_CUSTOM`)
ShowFooterVersion = Cfg.Section("other").Key("SHOW_FOOTER_VERSION").MustBool()
ShowFooterTemplateLoadTime = Cfg.Section("other").Key("SHOW_FOOTER_TEMPLATE_LOAD_TIME").MustBool()
+ UI.ShowUserEmailInExplore = Cfg.Section("ui").Key("SHOW_USER_EMAIL_IN_EXPLORE").MustBool()
+
HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt"))
}
diff --git a/routers/home.go b/routers/home.go
index 3b51148762254..2f26c221e2703 100644
--- a/routers/home.go
+++ b/routers/home.go
@@ -186,6 +186,7 @@ func RenderUserSearch(ctx *context.Context, opts *UserSearchOptions) {
ctx.Data["Total"] = count
ctx.Data["Page"] = paginater.New(int(count), opts.PageSize, page, 5)
ctx.Data["Users"] = users
+ ctx.Data["ShowUserEmail"] = setting.UI.ShowUserEmailInExplore
ctx.HTML(200, opts.TplName)
}
diff --git a/templates/explore/users.tmpl b/templates/explore/users.tmpl
index 09091df253a43..84ab7ad7fbcf8 100644
--- a/templates/explore/users.tmpl
+++ b/templates/explore/users.tmpl
@@ -16,7 +16,7 @@
{{if .Location}}
{{.Location}}
{{end}}
- {{if and .Email $.IsSigned}}
+ {{if and $.ShowUserEmail .Email $.IsSigned}}
{{.Email}}
{{end}}