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](c8b6797b-eb45-4dec-99db-1b0649a34ec5)

new:

![grafik](ab1a65ae-de5b-4ce4-9813-3b8b39c7922e)

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
KN4CK3R 2024-02-01 18:10:16 +01:00 committed by GitHub
parent 3a66762130
commit c3e462921e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 18 additions and 29 deletions

View file

@ -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 {

View file

@ -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
});
});