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 4 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
5 changes: 4 additions & 1 deletion modules/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,13 @@ var (
ScriptType = "bash"

// UI settings
UI = struct {
UI struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong and makes Drone fail :(

ExplorePagingNum int
IssuePagingNum int
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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace MustBool() with 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