Skip to content

Commit 6d02f58

Browse files
committed
Merge branch 'main' into lunny/fix_issue_comment_num
2 parents ee4bf00 + 1dbf0d7 commit 6d02f58

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

services/webhook/webhook_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@ import (
99
"code.gitea.io/gitea/models/db"
1010
repo_model "code.gitea.io/gitea/models/repo"
1111
"code.gitea.io/gitea/models/unittest"
12+
user_model "code.gitea.io/gitea/models/user"
1213
webhook_model "code.gitea.io/gitea/models/webhook"
14+
"code.gitea.io/gitea/modules/setting"
1315
api "code.gitea.io/gitea/modules/structs"
1416
webhook_module "code.gitea.io/gitea/modules/webhook"
17+
"code.gitea.io/gitea/services/convert"
1518

1619
"github.com/stretchr/testify/assert"
20+
"github.com/stretchr/testify/require"
1721
)
1822

1923
func TestWebhook_GetSlackHook(t *testing.T) {
@@ -77,3 +81,11 @@ func TestPrepareWebhooksBranchFilterNoMatch(t *testing.T) {
7781
unittest.AssertNotExistsBean(t, hookTask)
7882
}
7983
}
84+
85+
func TestWebhookUserMail(t *testing.T) {
86+
require.NoError(t, unittest.PrepareTestDatabase())
87+
setting.Service.NoReplyAddress = "no-reply.com"
88+
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1})
89+
assert.Equal(t, user.GetPlaceholderEmail(), convert.ToUser(db.DefaultContext, user, nil).Email)
90+
assert.Equal(t, user.Email, convert.ToUser(db.DefaultContext, user, user).Email)
91+
}

templates/repo/issue/view_content/comments.tmpl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,9 @@
365365
{{if .Review}}{{$reviewType = .Review.Type}}{{end}}
366366
{{if not .OriginalAuthor}}
367367
{{/* Some timeline avatars need a offset to correctly align with their speech bubble.
368-
The condition depends on whether the comment has contents/attachments or reviews */}}
369-
<a class="timeline-avatar{{if or .Content .Attachments (and .Review .Review.CodeComments)}} timeline-avatar-offset{{end}}"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
368+
The condition depends on whether the comment has contents/attachments,
369+
review's comment is also controlled/rendered by issue comment's Content field */}}
370+
<a class="timeline-avatar{{if or .Content .Attachments}} timeline-avatar-offset{{end}}"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
370371
{{ctx.AvatarUtils.Avatar .Poster 40}}
371372
</a>
372373
{{end}}

0 commit comments

Comments
 (0)