Skip to content

Commit d8673a8

Browse files
committed
✨(frontend) display full name if available
We can get the full name from the OIDC, so we should display it if available.
1 parent a5af9f0 commit d8673a8

File tree

7 files changed

+15
-5
lines changed

7 files changed

+15
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to
1414
- 📝Contributing.md #352
1515
- 🌐(frontend) add localization to editor #268
1616
- ✨Public and restricted doc editable #357
17+
- ✨(frontend) Add full name if available #380
1718

1819
## Fixed
1920

src/frontend/apps/e2e/__tests__/app-impress/doc-header.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ test.describe('Doc Header', () => {
2121
role: 'owner',
2222
user: {
2323
24+
full_name: 'Super Owner',
2425
},
2526
},
2627
{
@@ -65,7 +66,7 @@ test.describe('Doc Header', () => {
6566
card.getByText('Created at 09/01/2021, 11:00 AM'),
6667
).toBeVisible();
6768
await expect(
68-
card.getByText('Owners: [email protected] / [email protected]'),
69+
card.getByText('Owners: Super Owner / [email protected]'),
6970
).toBeVisible();
7071
await expect(card.getByText('Your role: Owner')).toBeVisible();
7172
await expect(page.getByRole('button', { name: 'Share' })).toBeVisible();

src/frontend/apps/e2e/__tests__/app-impress/doc-member-list.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ test.describe('Document list members', () => {
2525
user: {
2626
id: `fc092149-cafa-4ffa-a29d-e4b18af751-${pageId}-${i}`,
2727
email: `[email protected]${pageId}-${i}`,
28+
full_name: `Impress World Page ${pageId}-${i}`,
2829
},
2930
team: '',
3031
role: 'editor',
@@ -58,9 +59,11 @@ test.describe('Document list members', () => {
5859
await waitForElementCount(list.locator('li'), 21, 10000);
5960

6061
expect(await list.locator('li').count()).toBeGreaterThan(20);
62+
await expect(list.getByText(`Impress World Page 1-16`)).toBeVisible();
6163
await expect(
6264
list.getByText(`[email protected]`),
6365
).toBeVisible();
66+
await expect(list.getByText(`Impress World Page 2-15`)).toBeVisible();
6467
await expect(
6568
list.getByText(`[email protected]`),
6669
).toBeVisible();

src/frontend/apps/impress/src/core/auth/api/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88
export interface User {
99
id: string;
1010
email: string;
11+
full_name: string;
12+
short_name: string;
1113
}

src/frontend/apps/impress/src/features/docs/doc-header/components/DocHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export const DocHeader = ({ doc, versionId }: DocHeaderProps) => {
104104
)
105105
.map((access, index, accesses) => (
106106
<Fragment key={`access-${index}`}>
107-
{access.user.email}{' '}
107+
{access.user.full_name || access.user.email}{' '}
108108
{index < accesses.length - 1 ? ' / ' : ''}
109109
</Fragment>
110110
))}

src/frontend/apps/impress/src/features/docs/members/members-list/components/MemberItem.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@ export const MemberItem = ({
8484
$css={`flex: ${isSmallMobile ? '100%' : '70%'};`}
8585
>
8686
<IconBG iconName="account_circle" $size="2rem" />
87-
<Text $justify="center" $css="flex:1;">
88-
{access.user.email}
89-
</Text>
87+
<Box $justify="center" $css="flex:1;">
88+
{access.user.full_name && <Text>{access.user.full_name}</Text>}
89+
<Text>{access.user.email}</Text>
90+
</Box>
9091
<Box
9192
$direction="row"
9293
$gap="1rem"

src/frontend/apps/impress/src/features/service-worker/ApiPlugin.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ export class ApiPlugin implements WorkboxPlugin {
213213
user: {
214214
id: 'dummy-id',
215215
email: 'dummy-email',
216+
full_name: 'dummy-full-name',
217+
short_name: 'dummy-short-name',
216218
},
217219
abilities: {
218220
destroy: false,

0 commit comments

Comments
 (0)