Skip to content

Commit c7422a7

Browse files
committed
fix profile
1 parent 22fec16 commit c7422a7

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

routers/web/user/profile.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ func Profile(ctx *context.Context) {
308308
ctx.Data["IsPackageEnabled"] = setting.Packages.Enabled
309309
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled
310310

311-
ctx.Data["ShowUserEmail"] = len(ctx.ContextUser.Email) > 0 && ctx.IsSigned && (!ctx.ContextUser.KeepEmailPrivate || ctx.ContextUser.ID == ctx.Doer.ID)
311+
ctx.Data["ShowUserEmail"] = setting.UI.ShowUserEmail && ctx.ContextUser.Email != "" && ctx.IsSigned && !ctx.ContextUser.KeepEmailPrivate
312312

313313
ctx.HTML(http.StatusOK, tplProfile)
314314
}

templates/user/profile.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="ui stackable grid">
55
<div class="ui five wide column">
66
<div class="ui card">
7-
<div id="profile-avatar" class="content gt-df"/>
7+
<div id="profile-avatar" class="content gt-df">
88
{{if eq .SignedUserName .Owner.Name}}
99
<a class="image" href="{{AppSubUrl}}/user/settings" data-tooltip-content="{{.locale.Tr "user.change_avatar"}}">
1010
{{avatar $.Context .Owner 290}}

tests/integration/setting_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ func TestSettingShowUserEmailProfile(t *testing.T) {
6161
req = NewRequest(t, "GET", "/user2")
6262
resp = session.MakeRequest(t, req, http.StatusOK)
6363
htmlDoc = NewHTMLParser(t, resp.Body)
64-
// Should contain since this user owns the profile page
65-
assert.Contains(t,
64+
// Should not contain even if the user visits their own profile page
65+
assert.NotContains(t,
6666
htmlDoc.doc.Find(".user.profile").Text(),
6767
"user2@example.com",
6868
)

0 commit comments

Comments
 (0)