Skip to content

Commit 55c43e6

Browse files
authored
Merge branch 'main' into deps-api
2 parents 438c87b + 8df1b4b commit 55c43e6

File tree

6 files changed

+41
-30
lines changed

6 files changed

+41
-30
lines changed

docs/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ params:
1818
description: Git with a cup of tea
1919
author: The Gitea Authors
2020
website: https://docs.gitea.io
21-
version: 1.18.5
21+
version: 1.19.0
2222
minGoVersion: 1.19
2323
goVersion: 1.20
2424
minNodeVersion: 16

routers/web/user/profile.go

Lines changed: 1 addition & 1 deletion
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/repo/graph/commits.tmpl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
{{- end -}}
2929
</a>
3030
</span>
31-
<span class="message gt-dib gt-ellipsis gt-mr-2">
31+
<span class="message gt-dib gt-ellipsis gt-mr-3">
3232
<span>{{RenderCommitMessage $.Context $commit.Subject $.RepoLink $.Repository.ComposeMetas}}</span>
3333
</span>
34-
<span class="tags gt-df gt-ac">
34+
<span class="tags gt-df gt-ac gt-mr-2">
3535
{{range $commit.Refs}}
3636
{{$refGroup := .RefGroup}}
3737
{{if eq $refGroup "pull"}}
@@ -54,20 +54,20 @@
5454
{{svg "octicon-git-branch" 16 "gt-mr-2"}}{{.ShortName}}
5555
</a>
5656
{{else}}
57-
<!-- Unknown ref type {{.Name}} -->
57+
<!-- Unknown ref type .Name -->
5858
{{end}}
5959
{{end}}
6060
</span>
61-
<span class="author gt-df gt-ac gt-mr-2">
61+
<span class="author gt-df gt-ac gt-mr-3">
6262
{{$userName := $commit.Commit.Author.Name}}
6363
{{if $commit.User}}
6464
{{if $commit.User.FullName}}
6565
{{$userName = $commit.User.FullName}}
6666
{{end}}
67-
{{avatar $.Context $commit.User}}
67+
<span class="gt-mr-2">{{avatar $.Context $commit.User}}</span>
6868
<a href="{{$commit.User.HomeLink}}">{{$userName}}</a>
6969
{{else}}
70-
{{avatarByEmail $.Context $commit.Commit.Author.Email $userName}}
70+
<span class="gt-mr-2">{{avatarByEmail $.Context $commit.Commit.Author.Email $userName}}</span>
7171
{{$userName}}
7272
{{end}}
7373
</span>

templates/repo/graph/svgcontainer.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
{{- else if eq $glyph.Glyph '_' -}}
1515
M {{Add (Mul $glyph.Column 5) 0}} {{Add (Mul $glyph.Row 12) 12}} h 10 {{/* */ -}}
1616
{{- end -}}
17-
{{- end}}" stroke-width="1" fill="none" id="flow-{{$flow.ID}}-path" stroke-linecap="round">
17+
{{- end}}" stroke-width="1" fill="none" id="flow-{{$flow.ID}}-path" stroke-linecap="round"></path>
1818
{{range $flow.Commits}}
19-
<circle class="flow-commit" cx="{{Add (Mul .Column 5) 5}}" cy="{{Add (Mul .Row 12) 6}}" r="2.5" stroke="none" id="flow-commit-{{.Rev}}" data-rev="{{.Rev}}">
19+
<circle class="flow-commit" cx="{{Add (Mul .Column 5) 5}}" cy="{{Add (Mul .Row 12) 6}}" r="2.5" stroke="none" id="flow-commit-{{.Rev}}" data-rev="{{.Rev}}"></circle>
2020
{{end}}
2121
</g>
2222
{{end}}

tests/integration/setting_test.go

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,38 +45,49 @@ func TestSettingShowUserEmailProfile(t *testing.T) {
4545
defer tests.PrepareTestEnv(t)()
4646

4747
showUserEmail := setting.UI.ShowUserEmail
48+
49+
// user1: keep_email_private = false, user2: keep_email_private = true
50+
4851
setting.UI.ShowUserEmail = true
4952

50-
session := loginUser(t, "user2")
51-
req := NewRequest(t, "GET", "/user2")
53+
// user1 can see self
54+
session := loginUser(t, "user1")
55+
req := NewRequest(t, "GET", "/user1")
5256
resp := session.MakeRequest(t, req, http.StatusOK)
5357
htmlDoc := NewHTMLParser(t, resp.Body)
54-
assert.Contains(t,
55-
htmlDoc.doc.Find(".user.profile").Text(),
56-
57-
)
58-
59-
setting.UI.ShowUserEmail = false
58+
assert.Contains(t, htmlDoc.doc.Find(".user.profile").Text(), "[email protected]")
6059

60+
// user1 can not see user2
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,
66-
htmlDoc.doc.Find(".user.profile").Text(),
67-
68-
)
64+
// Should not contain even if the user visits their own profile page
65+
assert.NotContains(t, htmlDoc.doc.Find(".user.profile").Text(), "[email protected]")
6966

70-
setting.UI.ShowUserEmail = showUserEmail
67+
// user2 can see user1
68+
session = loginUser(t, "user2")
69+
req = NewRequest(t, "GET", "/user1")
70+
resp = session.MakeRequest(t, req, http.StatusOK)
71+
htmlDoc = NewHTMLParser(t, resp.Body)
72+
assert.Contains(t, htmlDoc.doc.Find(".user.profile").Text(), "[email protected]")
7173

72-
session = loginUser(t, "user4")
74+
// user2 can not see self
75+
session = loginUser(t, "user2")
7376
req = NewRequest(t, "GET", "/user2")
7477
resp = session.MakeRequest(t, req, http.StatusOK)
7578
htmlDoc = NewHTMLParser(t, resp.Body)
76-
assert.NotContains(t,
77-
htmlDoc.doc.Find(".user.profile").Text(),
78-
79-
)
79+
assert.NotContains(t, htmlDoc.doc.Find(".user.profile").Text(), "[email protected]")
80+
81+
setting.UI.ShowUserEmail = false
82+
83+
// user1 can not see self
84+
session = loginUser(t, "user1")
85+
req = NewRequest(t, "GET", "/user1")
86+
resp = session.MakeRequest(t, req, http.StatusOK)
87+
htmlDoc = NewHTMLParser(t, resp.Body)
88+
assert.NotContains(t, htmlDoc.doc.Find(".user.profile").Text(), "[email protected]")
89+
90+
setting.UI.ShowUserEmail = showUserEmail
8091
}
8192

8293
func TestSettingLandingPage(t *testing.T) {

web_src/js/features/repo-issue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function updateDeadline(deadlineString) {
7878

7979
export function initRepoIssueDue() {
8080
$(document).on('click', '.issue-due-edit', () => {
81-
$('#deadlineForm').fadeToggle(150);
81+
toggleElem('#deadlineForm');
8282
});
8383
$(document).on('click', '.issue-due-remove', () => {
8484
updateDeadline('');

0 commit comments

Comments
 (0)