Skip to content

Commit

Permalink
UI config to toggle whether user email shows up in Explore Users
Browse files Browse the repository at this point in the history
  • Loading branch information
Avelino committed Dec 2, 2016
1 parent 5ab8537 commit 66a1c59
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions conf/app.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions modules/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"))
}

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

0 comments on commit 66a1c59

Please sign in to comment.