Skip to content

Commit 787fda5

Browse files
Thiago Avelinolunny
Thiago Avelino
authored andcommitted
UI config to toggle whether user email shows up in Explore Users (#336)
* UI config to toggle whether user email shows up in Explore Users * Recommendation made by @tboerger 66a1c59#r94122732 * fixed typo, rename ShowUserEmailInExplore to ShowUserEmail * Fixed typo merged conflict * Hide email in the user profile page if you are active ShowUserEmail ref #336 (comment) * Please replace MustBool() with MustBool(true)
1 parent a09a3dc commit 787fda5

File tree

5 files changed

+8
-2
lines changed

5 files changed

+8
-2
lines changed

conf/app.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ FEED_MAX_COMMIT_NUM = 5
5757
THEME_COLOR_META_TAG = `#6cc644`
5858
; Max size of files to be displayed (defaults is 8MiB)
5959
MAX_DISPLAY_FILE_SIZE = 8388608
60+
; Whether show the user email in the Explore Users page
61+
SHOW_USER_EMAIL = true
6062

6163
[ui.admin]
6264
; Number of users that are showed in one page

modules/setting/setting.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ var (
203203
FeedMaxCommitNum int
204204
ThemeColorMetaTag string
205205
MaxDisplayFileSize int64
206+
ShowUserEmail bool
206207

207208
Admin struct {
208209
UserPagingNum int
@@ -820,6 +821,8 @@ please consider changing to GITEA_CUSTOM`)
820821
ShowFooterVersion = Cfg.Section("other").Key("SHOW_FOOTER_VERSION").MustBool(true)
821822
ShowFooterTemplateLoadTime = Cfg.Section("other").Key("SHOW_FOOTER_TEMPLATE_LOAD_TIME").MustBool(true)
822823

824+
UI.ShowUserEmail = Cfg.Section("ui").Key("SHOW_USER_EMAIL").MustBool(true)
825+
823826
HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt"))
824827
}
825828

routers/home.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ func RenderUserSearch(ctx *context.Context, opts *UserSearchOptions) {
229229
ctx.Data["Total"] = count
230230
ctx.Data["Page"] = paginater.New(int(count), opts.PageSize, page, 5)
231231
ctx.Data["Users"] = users
232+
ctx.Data["ShowUserEmail"] = setting.UI.ShowUserEmail
232233

233234
ctx.HTML(200, opts.TplName)
234235
}

templates/explore/users.tmpl

Lines changed: 1 addition & 1 deletion
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}}

templates/user/profile.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
{{if .Owner.Location}}
2323
<li><i class="octicon octicon-location"></i> {{.Owner.Location}}</li>
2424
{{end}}
25-
{{if and .Owner.Email .IsSigned}}
25+
{{if and $.ShowUserEmail .Owner.Email .IsSigned}}
2626
<li>
2727
<i class="octicon octicon-mail"></i>
2828
<a href="mailto:{{.Owner.Email}}" rel="nofollow">{{.Owner.Email}}</a>

0 commit comments

Comments
 (0)