Skip to content

Commit 8e39d06

Browse files
committed
fix a small nit and update test code
1 parent 14672ea commit 8e39d06

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

modules/markup/html.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,9 +602,9 @@ func mentionProcessor(ctx *postProcessCtx, node *html.Node) {
602602
if mentionOrgAndTeam[0][1:] == ctx.metas["org"] && strings.Contains(teams, ","+strings.ToLower(mentionOrgAndTeam[1])+",") {
603603
replaceContent(node, loc.Start, loc.End, createLink(util.URLJoin(setting.AppURL, "org", ctx.metas["org"], "teams", mentionOrgAndTeam[1]), mention, "mention"))
604604
}
605-
} else {
606-
replaceContent(node, loc.Start, loc.End, createLink(util.URLJoin(setting.AppURL, mention[1:]), mention, "mention"))
605+
return
607606
}
607+
replaceContent(node, loc.Start, loc.End, createLink(util.URLJoin(setting.AppURL, mention[1:]), mention, "mention"))
608608
}
609609

610610
func shortLinkProcessor(ctx *postProcessCtx, node *html.Node) {

modules/references/references_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ func TestRegExp_mentionPattern(t *testing.T) {
325325
{"@gitea.", "@gitea"},
326326
{"@gitea,", "@gitea"},
327327
{"@gitea;", "@gitea"},
328+
{"@gitea/team1;", "@gitea/team1"},
328329
}
329330
falseTestCases := []string{
330331
"@ 0",
@@ -340,6 +341,7 @@ func TestRegExp_mentionPattern(t *testing.T) {
340341
"@gitea?this",
341342
"@gitea,this",
342343
"@gitea;this",
344+
"@gitea/team1/more",
343345
}
344346

345347
for _, testCase := range trueTestCases {

0 commit comments

Comments
 (0)