summaryrefslogtreecommitdiffstats
path: root/modules/templates
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2024-05-02 09:48:24 +0800
committerGitHub <noreply@github.com>2024-05-02 09:48:24 +0800
commitac91bb27ffaad293f86b8160ed1d90159df6242f (patch)
tree0bb8daa77cdddaaa4a2f3c0cb2598f1500227fce /modules/templates
parent97a7c04a8fc4747d32af84fca3d068425ab33768 (diff)
downloadgitea-ac91bb27ffaad293f86b8160ed1d90159df6242f.tar.gz
gitea-ac91bb27ffaad293f86b8160ed1d90159df6242f.zip
Fix markdown rendering when mentioning users (#30795) (#30810)
Backport #30795 by wxiaoguang Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'modules/templates')
-rw-r--r--modules/templates/util_render_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/templates/util_render_test.go b/modules/templates/util_render_test.go
index 47c5da6485..f493b899e3 100644
--- a/modules/templates/util_render_test.go
+++ b/modules/templates/util_render_test.go
@@ -207,3 +207,8 @@ func TestRenderLabels(t *testing.T) {
expected = `/owner/repo/pulls?labels=123`
assert.Contains(t, RenderLabels(ctx, locale, []*issues.Label{label}, "/owner/repo", issue), expected)
}
+
+func TestUserMention(t *testing.T) {
+ rendered := RenderMarkdownToHtml(context.Background(), "@no-such-user @mention-user @mention-user")
+ assert.EqualValues(t, `<p>@no-such-user <a href="/mention-user" rel="nofollow">@mention-user</a> <a href="/mention-user" rel="nofollow">@mention-user</a></p>`, strings.TrimSpace(string(rendered)))
+}