aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2024-02-01 18:10:16 +0100
committerGitHub <noreply@github.com>2024-02-01 17:10:16 +0000
commitc3e462921ee31536e59b37e654ed20e92a37ffe6 (patch)
treee4576da296cccc84ae622e2def52f69f80393f4a /web_src/js
parent3a667621306216b1724ba1a9b23d61a4f7aff50d (diff)
downloadgitea-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 'web_src/js')
-rw-r--r--web_src/js/features/comp/SearchUserBox.js9
-rw-r--r--web_src/js/features/repo-settings.js4
2 files changed, 6 insertions, 7 deletions
diff --git a/web_src/js/features/comp/SearchUserBox.js b/web_src/js/features/comp/SearchUserBox.js
index 960b787fea..992d4ef020 100644
--- a/web_src/js/features/comp/SearchUserBox.js
+++ b/web_src/js/features/comp/SearchUserBox.js
@@ -17,14 +17,13 @@ export function initCompSearchUserBox() {
const searchQuery = $searchUserBox.find('input').val();
const searchQueryUppercase = searchQuery.toUpperCase();
$.each(response.data, (_i, item) => {
- let title = item.login;
- if (item.full_name && item.full_name.length > 0) {
- title += ` (${htmlEscape(item.full_name)})`;
- }
const resultItem = {
- title,
+ title: item.login,
image: item.avatar_url
};
+ if (item.full_name) {
+ resultItem.description = htmlEscape(item.full_name);
+ }
if (searchQueryUppercase === item.login.toUpperCase()) {
items.unshift(resultItem);
} else {
diff --git a/web_src/js/features/repo-settings.js b/web_src/js/features/repo-settings.js
index 04974200bb..75e624a6a7 100644
--- a/web_src/js/features/repo-settings.js
+++ b/web_src/js/features/repo-settings.js
@@ -52,9 +52,9 @@ export function initRepoSettingSearchTeamBox() {
onResponse(response) {
const items = [];
$.each(response.data, (_i, item) => {
- const title = `${item.name} (${item.permission} access)`;
items.push({
- title,
+ title: item.name,
+ description: `${item.permission} access` // TODO: translate this string
});
});