hangups icon indicating copy to clipboard operation
hangups copied to clipboard

fix for #121 (multiple identical first names)

Open dlenski opened this issue 8 years ago • 6 comments

This builds on top of #200, and fixes the issue of identical first names leading to a hard-to-follow conversations.

As a Daniel with many friends named Dan or Daniel, I feel the pain of the folks who reported #121 :+1:.

Any time a new user appears in the user list, this patch revisits the UserList and ensures that each name is represented uniquely by including (only if necessary) either the last initial or the whole name.

For example, this userlist would be mapped as follows:

Daniel Smith   -> Daniel S
Daniel Jones   -> Daniel Jones
Daniel Johnson -> Daniel Johnson
Daniel Lenski  -> Daniel L
Steve Jones    -> Steve

Now, if a new user ("Daniel Schmidt") joins the party, both Daniel Smith and Daniel Schmidt's full last names will be added.

dlenski avatar Jan 04 '16 00:01 dlenski

Perhaps this is not immediately relevant, but the unique_name strategy will make a bit of a mess of names that don't follow the typical English-speaking world's convention of Firstname Middlename Lastname.

I wonder if there are existing libraries out there that deal with this problem in a multilingual way… ?

dlenski avatar Jan 04 '16 00:01 dlenski

Seems to be working fine on my end. I do have one guy whose first name only appears once in the user list, however, his name has the first letter of his last name appended to it.

I come from a land where Lastname Firstname is the default writing way, but seems like Google does the switching nevertheless. (So it works fine)

vista- avatar Jan 04 '16 00:01 vista-

Ah, that may be a problem. I am not sure how the full_name and first_name fields are actually provided by Google's server in such an environment. (I'm going to guess the language is Magyar since you mentioned typical Western-sounding first names.)

You might try commenting out user.py lines 113-118 and see if that fixes the problem for you, by allowing only two alternatives, either first_name or full_name as unique_name (rather than the third possibility of first_name last_initial).

dlenski avatar Jan 04 '16 01:01 dlenski

Nice solution! Do any of Google's clients solve the issue this way?

Since this is a UI issue, I think it would be more appropriate to solve it purely in the UI code (eg. have hangups/ui/utils.py handle choosing the unique names).

tdryer avatar Jan 09 '16 00:01 tdryer

I don't believe Google's own Hangouts clients do this, exactly. Although Gmail does something pretty similar when an email is addressed to multiple people with the same first name.

It probably would be more appropriate to handle this in ui/utils.py, but I couldn't really figure out a clean way to do that, since the only place that stateful information about the users is stored is in UserList. Do you have any suggestions?

dlenski avatar Jan 09 '16 08:01 dlenski

We could add a stateful NameFormatter class to be used by the UI.

tdryer avatar Jan 09 '16 21:01 tdryer