diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2024-02-01 18:10:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-01 17:10:16 +0000 |
commit | c3e462921ee31536e59b37e654ed20e92a37ffe6 (patch) | |
tree | e4576da296cccc84ae622e2def52f69f80393f4a /routers/utils | |
parent | 3a667621306216b1724ba1a9b23d61a4f7aff50d (diff) | |
download | gitea-c3e462921ee31536e59b37e654ed20e92a37ffe6.tar.gz gitea-c3e462921ee31536e59b37e654ed20e92a37ffe6.zip |
Improve user search display name (#29002)
I tripped over this strange method and I don't think we need that
workaround to fix the value.
old:
![grafik](https://github.com/go-gitea/gitea/assets/1666336/c8b6797b-eb45-4dec-99db-1b0649a34ec5)
new:
![grafik](https://github.com/go-gitea/gitea/assets/1666336/ab1a65ae-de5b-4ce4-9813-3b8b39c7922e)
---------
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'routers/utils')
-rw-r--r-- | routers/utils/utils.go | 8 | ||||
-rw-r--r-- | routers/utils/utils_test.go | 6 |
2 files changed, 0 insertions, 14 deletions
diff --git a/routers/utils/utils.go b/routers/utils/utils.go index d6856fceac..1f4d11fd3c 100644 --- a/routers/utils/utils.go +++ b/routers/utils/utils.go @@ -11,14 +11,6 @@ import ( "code.gitea.io/gitea/modules/setting" ) -// RemoveUsernameParameterSuffix returns the username parameter without the (fullname) suffix - leaving just the username -func RemoveUsernameParameterSuffix(name string) string { - if index := strings.Index(name, " ("); index >= 0 { - name = name[:index] - } - return name -} - // SanitizeFlashErrorString will sanitize a flash error string func SanitizeFlashErrorString(x string) string { return strings.ReplaceAll(html.EscapeString(x), "\n", "<br>") diff --git a/routers/utils/utils_test.go b/routers/utils/utils_test.go index 6d19214c88..440aad87c6 100644 --- a/routers/utils/utils_test.go +++ b/routers/utils/utils_test.go @@ -11,12 +11,6 @@ import ( "github.com/stretchr/testify/assert" ) -func TestRemoveUsernameParameterSuffix(t *testing.T) { - assert.Equal(t, "foobar", RemoveUsernameParameterSuffix("foobar (Foo Bar)")) - assert.Equal(t, "foobar", RemoveUsernameParameterSuffix("foobar")) - assert.Equal(t, "", RemoveUsernameParameterSuffix("")) -} - func TestIsExternalURL(t *testing.T) { setting.AppURL = "https://try.gitea.io/" type test struct { |