feat(ui): highlight user mention in comments and commit messages
This commit is contained in:
parent
bd42f677b4
commit
634519e891
|
@ -26,6 +26,7 @@
|
||||||
.ui.secondary.menu .dropdown.item > .menu { margin-top: 0; }
|
.ui.secondary.menu .dropdown.item > .menu { margin-top: 0; }
|
||||||
</style>
|
</style>
|
||||||
</noscript>
|
</noscript>
|
||||||
|
{{template "shared/user/mention_highlight" .}}
|
||||||
{{template "base/head_opengraph" .}}
|
{{template "base/head_opengraph" .}}
|
||||||
{{template "base/head_style" .}}
|
{{template "base/head_style" .}}
|
||||||
{{template "custom/header" .}}
|
{{template "custom/header" .}}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
{{if .IsSigned}}
|
||||||
|
<style>
|
||||||
|
.comment,
|
||||||
|
.commit-summary,
|
||||||
|
.commit-body {
|
||||||
|
.mention[href="{{AppSubUrl}}/{{.SignedUser.Name}}" i] {
|
||||||
|
background-color: var(--color-primary-alpha-30);
|
||||||
|
color: var(--color-primary-dark-2);
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 1px 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{{end}}
|
|
@ -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="`)
|
||||||
|
}
|
Loading…
Reference in New Issue