In a UX discussion titled “In search result drop box: add given name next to username,” rriemann proposed displaying users’ given names alongside usernames in search results to clarify identities when names differ from handles. rriemann outlined the technical approach, noting that the name field exists in the JSON but wasn’t rendering in the UI.
fantasticfears guided the debugging process, suggesting that the name attribute needs to be included in the serializer and accessed via the Ember model. Although rriemann initially faced issues where u.name was undefined, designbygio joined the thread and submitted a PR to implement the change. The team discussed visual design, with sam advocating for a clean look using bold usernames and standard-weight names to maintain consistency with site settings.
Technical challenges arose regarding Active Model Serializers throwing errors when :name was added to the BasicUserSerializer. sam recommended creating a specific serializer for search results rather than modifying the base serializer used globally. fantasticfears suggested the GroupedSearchResultsSerializer as the target. Ultimately, designbygio created a SearchResultUserSerializer inheriting from BasicUserSerializer to include the name attribute. The feature was successfully implemented, adding a clean display of given names in search dropdowns, as shown in the final screenshot by designbygio.
in my community, the usernames might differ a lot from the given name. The results to a search also consider the given name, even though it is not displayed. If someone looks for the given name Robert and finds only @asdf2016, it is not be evident that this is actually Robert.
It’s a magic trick to determine whether name should be included by the serializer. If it’s true, you can find that field in the JSON.
After that, Ember model and widget kicks in. Try console.log(u) in that function so that you can see what’s in the u. You could access name by u.name there. And you’ll need some class for colors probably.
There is a site setting for displaying order of username and name. You could check that site setting and putting the name there.
So as far as @designbygio’s PR is concerned, we’re saying go with the first example in @rriemann’s mockup, which does:
username Full Name
**username** Full Name
Still linking to username of course, but dropping the link styling, since the interactivity is obvious enough in the context of a search drop-down.
The second example in @rriemann’s mockup is a separate discussion and PR altogether. I think this is what we’re proposing:
IF enable names and display name on posts are enabled, and prioritize username in ux is disabled
(i.e. Full Names will display first by default, as shown on Meta)
THEN, also display Full Name first in drop-down-search results.
About style:
currently the username is not in bold. @erlend_sh what you said is:
username in bold and blue color, name normal font-weight and grey color.
Is that correct?
Honestly, I’m not sure about blue + grey.
I try that solution but i personally didn’t like.
Is there any other place in the app where these style is already used?
As Sam said, i want to keep consistent with other style but i didn’t find any place where these style is used.