From cb1d1da1948977e227caeebef131c80789a9d228 Mon Sep 17 00:00:00 2001 From: Ivan Semenov Date: Fri, 6 Feb 2026 16:19:13 +0100 Subject: [PATCH] refactor [github]: use the full user names where possible Won't work most of the time, because REST API doesn't return the full name GitOrigin-RevId: 14e2cf25d94d9dfe714656e1b06ecb71b77c81ca --- .../ui/filters/GHPRSearchPanelFactory.kt | 17 ++++------------- .../plugins/github/ui/util/GHUIUtil.kt | 4 ++-- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/plugins/github/github-core/src/org/jetbrains/plugins/github/pullrequest/ui/filters/GHPRSearchPanelFactory.kt b/plugins/github/github-core/src/org/jetbrains/plugins/github/pullrequest/ui/filters/GHPRSearchPanelFactory.kt index febae56a21b7..2c0e1ec37eb8 100644 --- a/plugins/github/github-core/src/org/jetbrains/plugins/github/pullrequest/ui/filters/GHPRSearchPanelFactory.kt +++ b/plugins/github/github-core/src/org/jetbrains/plugins/github/pullrequest/ui/filters/GHPRSearchPanelFactory.kt @@ -11,6 +11,7 @@ import kotlinx.coroutines.flow.flow import org.jetbrains.annotations.Nls import org.jetbrains.plugins.github.i18n.GithubBundle import org.jetbrains.plugins.github.ui.icons.GHAvatarIconsProvider +import org.jetbrains.plugins.github.ui.util.GHUIUtil import javax.swing.JComponent internal class GHPRSearchPanelFactory(vm: GHPRSearchPanelViewModel, private val avatarIconsProvider: GHAvatarIconsProvider) : @@ -41,12 +42,7 @@ internal class GHPRSearchPanelFactory(vm: GHPRSearchPanelViewModel, private val ChooserPopupUtil.showAsyncChooserPopup( point, itemsLoader = flow { emit(runCatching { vm.getAuthors() }) }, - presenter = { - PopupItemPresentation.Simple( - it.shortName, - avatarIconsProvider.getIcon(it.avatarUrl, Avatar.Sizes.BASE), - it.name?.let { fullName -> "(${fullName})" }) - } + presenter = GHUIUtil.SelectionPresenters.Users(avatarIconsProvider) )?.login }, DropDownComponentFactory(vm.labelFilterState) @@ -54,7 +50,7 @@ internal class GHPRSearchPanelFactory(vm: GHPRSearchPanelViewModel, private val ChooserPopupUtil.showAsyncChooserPopup( point, itemsLoader = flow { emit(runCatching { vm.getLabels() }) }, - presenter = { PopupItemPresentation.Simple(it.name) } + presenter = GHUIUtil.SelectionPresenters.Labels() )?.name }, DropDownComponentFactory(vm.assigneeFilterState) @@ -62,12 +58,7 @@ internal class GHPRSearchPanelFactory(vm: GHPRSearchPanelViewModel, private val ChooserPopupUtil.showAsyncChooserPopup( point, itemsLoader = flow { emit(runCatching { vm.getAssignees() }) }, - presenter = { - PopupItemPresentation.Simple( - it.shortName, - avatarIconsProvider.getIcon(it.avatarUrl, Avatar.Sizes.BASE), - it.name?.let { fullName -> "($fullName)" }) - } + presenter = GHUIUtil.SelectionPresenters.Users(avatarIconsProvider) )?.login }, DropDownComponentFactory(vm.reviewFilterState) diff --git a/plugins/github/github-core/src/org/jetbrains/plugins/github/ui/util/GHUIUtil.kt b/plugins/github/github-core/src/org/jetbrains/plugins/github/ui/util/GHUIUtil.kt index f0e4b2c429bf..792bb05bd028 100644 --- a/plugins/github/github-core/src/org/jetbrains/plugins/github/ui/util/GHUIUtil.kt +++ b/plugins/github/github-core/src/org/jetbrains/plugins/github/ui/util/GHUIUtil.kt @@ -47,7 +47,7 @@ internal object GHUIUtil { PopupItemPresentation.Simple( it.shortName, avatarIconsProvider.getIcon(it.avatarUrl, Avatar.Sizes.BASE), - null + it.name ) } @@ -55,7 +55,7 @@ internal object GHUIUtil { PopupItemPresentation.Simple( it.login, avatarIconsProvider.getIcon(it.avatarUrl, Avatar.Sizes.BASE), - null + it.name ) }