Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent Initials in Avatar #4172

Closed
1 task done
Martin-S-Taylor opened this issue Apr 15, 2020 · 11 comments
Closed
1 task done

Inconsistent Initials in Avatar #4172

Martin-S-Taylor opened this issue Apr 15, 2020 · 11 comments

Comments

@Martin-S-Taylor
Copy link

  • I have searched open and closed issues for duplicates

Bug Description

[May be a similar issue to #3006, reported over a year ago]

I always use my middle initial in my name ("Martin S Taylor") and for this reason usually put my first name as "Martin S" (which is how many people address me) and my surname as "Taylor".

On my iPhone, in the (avatar?) header, my name appears as MT. On my desktop iMac it appears as MS.

Shouldn't this be consistent?

Stay safe,

Martin S Taylor

Platform Info

Signal Version:
iMac: 1.33.0
iPhone: 3.7.1.0

Operating System: MacOS 10.14.6

@blackwatertepes
Copy link

The android app seems to render the initials, the same way the Desktop app currently does....
"David C. Hall" become "DC". I assume consistency across all platform would be preferred, but which way should it be?

@Martin-S-Taylor
Copy link
Author

Martin-S-Taylor commented May 27, 2020 via email

@nathanieltalbot
Copy link
Contributor

Hopping onto this chain -- I've been able to reproduce similar behavior with emojis in contact names on Android vs Desktop.

On Android, the avatar renders like this:

image

And on Desktop, it renders like this, ignoring the emojis in the name as valid characters.
image

I suspect that this is the same bug with initials that you referenced -- I'll see if I can look into this and replicate your bug. Emojis in contact names are likely more of an edge case, but consistency across platforms would be good.

@nathanieltalbot
Copy link
Contributor

@Martin-S-Taylor I was actually unable to replicate your specific bug between Android and Desktop, so it's likely something that's only different between iPhone and Desktop. That being said, if there is inconsistency between platforms that's probably worth looking at.

Android
image

Desktop
image

@Martin-S-Taylor
Copy link
Author

Martin-S-Taylor commented Jun 5, 2020 via email

@nvx2004
Copy link

nvx2004 commented Jan 31, 2021

Adding to what @nathanieltalbot mentioned, this also affects regular non-English characters; e.g.:

initials

On Android, the initials are rendered correctly as "LŠ".

@EvanHahn-Signal
Copy link
Contributor

We'd love help with this issue. If anyone would like to submit a pull request, we're happy to review it.

Here's how I'd do it:

  1. Get your development environment set up by following our contribution instructions. Make sure you can start the app and run the tests with yarn test-node.

    You may wish to run the tests as you work. In one terminal window, run yarn transpile --watch to rebuild the TypeScript files as you work. In another, run yarn test-node --watch to re-run the tests when files change.

  2. Create a test file for getInitials in ts/test-both/util/getInitials_test.ts. Here's some scaffolding to get you started:

    // Copyright 2021 Signal Messenger, LLC
    // SPDX-License-Identifier: AGPL-3.0-only
    
    import { assert } from 'chai';
    
    import { getInitials } from '../../util/getInitials';
    
    describe('getInitials', () => {
      it('returns undefined when passed undefined', () => {
        assert.isUndefined(getInitials(undefined));
      });
    
      it('returns undefined when passed an empty string', () => {
        assert.isUndefined(getInitials(undefined));
      });
    
      it('returns the first letter of a name that is just one ASCII word', () => {
        assert.strictEqual(getInitials('Foo'), 'F');
      });
    
      it('returns the first letter of a two-word ASCII name', () => {
        assert.strictEqual(getInitials('Foo Bar'), 'FB');
      });
    
      // ...more tests here...
    });

    You'll want to add tests for all of the cases above and make sure that they match Android. Make sure to test a variety of edge cases.

    Many of these tests will fail when you start.

  3. Update ts/util/getInitials.ts to make the tests pass. You may wish to refer to the Android codebase as inspiration.

  4. Once your tests pass, start the app and see if things work for you.

Let me know if I can help with any of this!

@kkstrk
Copy link
Contributor

kkstrk commented Feb 13, 2021

@EvanHahn-Signal I would like to work on this issue.

@EvanHahn-Signal
Copy link
Contributor

@kocvrek Sounds good! I hope my instructions are helpful. Feel free to ask any questions.

@kkstrk
Copy link
Contributor

kkstrk commented Feb 14, 2021

@EvanHahn-Signal I do have a question about a couple of edge cases. What should the function return for the following names?

‘FB’
‘F.B.’
‘Foo Bar, Jr.’
‘Foo Bar III’

@Martin-S-Taylor
Copy link
Author

I would say that all of these should appear as FB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

8 participants