diff --git a/packages/git-ui/src/components/molecules/author-facepile.jsx b/packages/git-ui/src/components/molecules/author-facepile.jsx index 5922c91..97dbbd7 100644 --- a/packages/git-ui/src/components/molecules/author-facepile.jsx +++ b/packages/git-ui/src/components/molecules/author-facepile.jsx @@ -77,7 +77,7 @@ function Face({ person, index }) { // between it and the one behind. A ring drawn here would have to guess // the colour behind the pile, which differs from one band to the next. className={cn( - 'relative size-[18px] shrink-0', + 'relative size-4 shrink-0', DEPTH[index], index > 0 && '-ml-1.5', )} diff --git a/packages/git-ui/src/lib/authors.js b/packages/git-ui/src/lib/authors.js index 445b160..711be6d 100644 --- a/packages/git-ui/src/lib/authors.js +++ b/packages/git-ui/src/lib/authors.js @@ -148,15 +148,17 @@ export function describeAuthor(ident) { title: `${ident} · named by @${owner()?.handle ?? account.handle}`, }; } - if (profile) { + // The DID rides out whether or not a profile is known, because it is what + // a face with no picture draws its pattern from. Seeding that from the name + // instead would give one person two faces on one page: an identicon beside + // their words, where the DID is in hand, and something else on their + // commits. + if (named) { return { - name: profile.displayName || profile.handle, - handle: profile.handle, - // The DID rides along so a face with no picture draws the same - // identicon here as it does beside this account's own words. Seeding - // it from the handle instead would give one person two patterns. + name: profile?.displayName || profile?.handle || name || email, + handle: profile?.handle ?? '', did: named, - avatar: profile.avatar, + avatar: profile?.avatar ?? '', atproto: true, title: `${ident} · claimed by @${owner()?.handle ?? account.handle}`, }; @@ -164,6 +166,7 @@ export function describeAuthor(ident) { return { name: name || email || 'unknown', handle: '', + did: '', avatar: '', atproto: false, title: ident, diff --git a/packages/git-ui/test/authors.test.js b/packages/git-ui/test/authors.test.js index 6bf4877..ee1e444 100644 --- a/packages/git-ui/test/authors.test.js +++ b/packages/git-ui/test/authors.test.js @@ -98,6 +98,25 @@ describe('describing a commit author', () => { expect(author.name).toBe('A Friend'); expect(author.handle).toBe('friend.example'); expect(author.atproto).toBe(true); + expect(author.did).toBe(FRIEND); + }); + + it('carries the DID of a claimed account that publishes no profile', async () => { + // The DID is what a face with no picture draws its pattern from, so + // dropping it here gave one person an identicon beside their words and a + // bare letter on their commits. + serve( + [{ email: 'friend@example.com', did: FRIEND }], + [{ did: OWNER, handle: 'owner.example', displayName: 'The Account' }], + ); + await loadAuthors(); + + const author = describeAuthor('Friend '); + expect(author.did).toBe(FRIEND); + expect(author.atproto).toBe(true); + // Nothing said what to call them, so the commit's own name stands. + expect(author.name).toBe('Friend'); + expect(author.avatar).toBe(''); }); it('reads a claim with neither DID nor label as the account itself', async () => {