From 66a1c59fe730eff019ce100673c6800cce7d102d Mon Sep 17 00:00:00 2001 From: Avelino Date: Fri, 2 Dec 2016 04:05:09 -0200 Subject: [PATCH 1/6] UI config to toggle whether user email shows up in Explore Users --- conf/app.ini | 2 ++ modules/setting/setting.go | 13 ++++++++----- routers/home.go | 1 + templates/explore/users.tmpl | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) 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}} From a2326883084c7c1ed300cfd564752d9077070975 Mon Sep 17 00:00:00 2001 From: Avelino Date: Thu, 29 Dec 2016 11:08:21 -0200 Subject: [PATCH 2/6] Recommendation made by @tboerger https://github.com/go-gitea/gitea/pull/336/commits/66a1c59fe730eff019ce100673c6800cce7d102d#r94122732 --- conf/app.ini | 2 +- modules/setting/setting.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/app.ini b/conf/app.ini index 27097f1a6f258..3bd0e8ea9c25d 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -58,7 +58,7 @@ 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_IN_EXPLORE = true +SHOW_USER_EMAIL = 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 1902d28330001..595f5d4a3b3b1 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -821,7 +821,7 @@ 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.ShowUserEmailInExplore = Cfg.Section("ui").Key("SHOW_USER_EMAIL_IN_EXPLORE").MustBool() + UI.ShowUserEmailInExplore = Cfg.Section("ui").Key("SHOW_USER_EMAIL").MustBool() HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt")) } From c3b7afd8f0076dcf05621a5b69d293b210786533 Mon Sep 17 00:00:00 2001 From: Avelino Date: Thu, 29 Dec 2016 18:39:51 -0200 Subject: [PATCH 3/6] fixed typo, rename ShowUserEmailInExplore to ShowUserEmail --- modules/setting/setting.go | 14 +++++++------- routers/home.go | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 595f5d4a3b3b1..29e5514e8ef65 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -198,12 +198,12 @@ var ( // UI settings UI struct { - ExplorePagingNum int - IssuePagingNum int - FeedMaxCommitNum int - ThemeColorMetaTag string - MaxDisplayFileSize int64 - ShowUserEmailInExplore bool + ExplorePagingNum int + IssuePagingNum int + FeedMaxCommitNum int + ThemeColorMetaTag string + MaxDisplayFileSize int64 + ShowUserEmail bool Admin struct { UserPagingNum int @@ -821,7 +821,7 @@ 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.ShowUserEmailInExplore = Cfg.Section("ui").Key("SHOW_USER_EMAIL").MustBool() + UI.ShowUserEmail = Cfg.Section("ui").Key("SHOW_USER_EMAIL").MustBool() HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt")) } diff --git a/routers/home.go b/routers/home.go index fbf23f2f7808c..f5172182d56d1 100644 --- a/routers/home.go +++ b/routers/home.go @@ -229,7 +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.ShowUserEmailInExplore + ctx.Data["ShowUserEmail"] = setting.UI.ShowUserEmail ctx.HTML(200, opts.TplName) } From 4c17aee988dc0f097bc890e5a105d99aa51dadac Mon Sep 17 00:00:00 2001 From: Thiago Avelino Date: Fri, 30 Dec 2016 16:00:21 -0200 Subject: [PATCH 4/6] Fixed typo merged conflict --- modules/setting/setting.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 29e5514e8ef65..64ada40b4d14d 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -197,7 +197,7 @@ var ( ScriptType = "bash" // UI settings - UI struct { + UI = struct { ExplorePagingNum int IssuePagingNum int FeedMaxCommitNum int From aa3b5b1a168855e9f3a15c20c86fe8c531f3fb33 Mon Sep 17 00:00:00 2001 From: Thiago Avelino Date: Sat, 31 Dec 2016 13:44:42 -0200 Subject: [PATCH 5/6] Hide email in the user profile page if you are active ShowUserEmail ref https://github.com/go-gitea/gitea/pull/336#issuecomment-269843725 --- templates/user/profile.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index 7734d94c9963b..8b17dc137ac19 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -22,7 +22,7 @@ {{if .Owner.Location}}
  • {{.Owner.Location}}
  • {{end}} - {{if and .Owner.Email .IsSigned}} + {{if and $.ShowUserEmail .Owner.Email .IsSigned}}
  • {{.Owner.Email}} From e00b96370736f2f4fa8d35c303f8270b560e53dc Mon Sep 17 00:00:00 2001 From: Thiago Avelino Date: Sat, 31 Dec 2016 16:10:43 -0200 Subject: [PATCH 6/6] Please replace MustBool() with MustBool(true) --- modules/setting/setting.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 64ada40b4d14d..9a8a52e1955f1 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -821,7 +821,7 @@ 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() + UI.ShowUserEmail = Cfg.Section("ui").Key("SHOW_USER_EMAIL").MustBool(true) HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt")) }