diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index 7753f49243..9eb5b5addf 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -26,6 +26,7 @@ .ui.secondary.menu .dropdown.item > .menu { margin-top: 0; } + {{template "shared/user/mention_highlight" .}} {{template "base/head_opengraph" .}} {{template "base/head_style" .}} {{template "custom/header" .}} diff --git a/templates/shared/user/mention_highlight.tmpl b/templates/shared/user/mention_highlight.tmpl new file mode 100644 index 0000000000..1551cef874 --- /dev/null +++ b/templates/shared/user/mention_highlight.tmpl @@ -0,0 +1,14 @@ +{{if .IsSigned}} + +{{end}} diff --git a/tests/integration/mention_test.go b/tests/integration/mention_test.go new file mode 100644 index 0000000000..36a0ccb312 --- /dev/null +++ b/tests/integration/mention_test.go @@ -0,0 +1,21 @@ +// Copyright 2024 The Forgejo Authors. All rights reserved. +// SPDX-License-Identifier: GPL-3.0-or-later + +package integration + +import ( + "net/http" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestHeadMentionCSS(t *testing.T) { + userSession := loginUser(t, "user2") + resp := userSession.MakeRequest(t, NewRequest(t, "GET", "/"), http.StatusOK) + assert.Contains(t, resp.Body.String(), `.mention[href="/user2" i]`) + + guestSession := emptyTestSession(t) + resp = guestSession.MakeRequest(t, NewRequest(t, "GET", "/"), http.StatusOK) + assert.NotContains(t, resp.Body.String(), `.mention[href="`) +}