Skip to content

Commit

Permalink
fix profile
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Mar 27, 2023
1 parent 22fec16 commit c7422a7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion routers/web/user/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func Profile(ctx *context.Context) {
ctx.Data["IsPackageEnabled"] = setting.Packages.Enabled
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled

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

ctx.HTML(http.StatusOK, tplProfile)
}
Expand Down
2 changes: 1 addition & 1 deletion templates/user/profile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="ui stackable grid">
<div class="ui five wide column">
<div class="ui card">
<div id="profile-avatar" class="content gt-df"/>
<div id="profile-avatar" class="content gt-df">
{{if eq .SignedUserName .Owner.Name}}
<a class="image" href="{{AppSubUrl}}/user/settings" data-tooltip-content="{{.locale.Tr "user.change_avatar"}}">
{{avatar $.Context .Owner 290}}
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/setting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ func TestSettingShowUserEmailProfile(t *testing.T) {
req = NewRequest(t, "GET", "/user2")
resp = session.MakeRequest(t, req, http.StatusOK)
htmlDoc = NewHTMLParser(t, resp.Body)
// Should contain since this user owns the profile page
assert.Contains(t,
// Should not contain even if the user visits their own profile page
assert.NotContains(t,
htmlDoc.doc.Find(".user.profile").Text(),
"user2@example.com",
)
Expand Down

0 comments on commit c7422a7

Please sign in to comment.