Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI config to toggle whether user email shows up in Explore Users #336

Merged
merged 7 commits into from
Jan 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions conf/app.ini
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ FEED_MAX_COMMIT_NUM = 5
THEME_COLOR_META_TAG = `#6cc644`
; 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 = true

[ui.admin]
; Number of users that are showed in one page
Expand Down
3 changes: 3 additions & 0 deletions modules/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ var (
FeedMaxCommitNum int
ThemeColorMetaTag string
MaxDisplayFileSize int64
ShowUserEmail bool

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

UI.ShowUserEmail = Cfg.Section("ui").Key("SHOW_USER_EMAIL").MustBool(true)

HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt"))
}

Expand Down
1 change: 1 addition & 0 deletions routers/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,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.ShowUserEmail

ctx.HTML(200, opts.TplName)
}
Expand Down
2 changes: 1 addition & 1 deletion templates/explore/users.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{{if .Location}}
<i class="octicon octicon-location"></i> {{.Location}}
{{end}}
{{if and .Email $.IsSigned}}
{{if and $.ShowUserEmail .Email $.IsSigned}}
<i class="octicon octicon-mail"></i>
<a href="mailto:{{.Email}}" rel="nofollow">{{.Email}}</a>
{{end}}
Expand Down
2 changes: 1 addition & 1 deletion templates/user/profile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{{if .Owner.Location}}
<li><i class="octicon octicon-location"></i> {{.Owner.Location}}</li>
{{end}}
{{if and .Owner.Email .IsSigned}}
{{if and $.ShowUserEmail .Owner.Email .IsSigned}}
<li>
<i class="octicon octicon-mail"></i>
<a href="mailto:{{.Owner.Email}}" rel="nofollow">{{.Owner.Email}}</a>
Expand Down