1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: show "System" for system users, instead of "User ID n" where n is the project's number in the order. (#7734)

Fixes a bug introduced with the new tooltips where the system user was
shown as "User ID n" instead of "System". The "n" in this case is
actually the user's index number in the list of project owners
(including duplicates).

There's a few things happening: 
1. Change the object for system owners: use `name` instead of
`description`. At the same time, remove the `description` property
completely because it's not used at the moment.
2. Remove the assignnment of `id: objectId(user)` to the user sent to
the User Avatar component. This was a leftover from when we split out
the AvatarGroup component, and is not something we use anymore.

Before:

![image](https://github.com/user-attachments/assets/bd348daf-c81e-4ea9-b8a9-f10af71a0da7)

After:

![image](https://github.com/user-attachments/assets/d147f7c7-d683-43ac-9ee2-6116f155dad6)
This commit is contained in:
Thomas Heartman 2024-08-02 13:29:31 +02:00 committed by GitHub
parent 4b6813aa5e
commit 993d87516d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 13 deletions

View File

@ -74,10 +74,7 @@ const GroupCardAvatarsInner = ({
return ( return (
<StyledAvatars> <StyledAvatars>
{shownUsers.map((user) => ( {shownUsers.map((user) => (
<AvatarComponent <AvatarComponent key={objectId(user)} user={user} />
key={objectId(user)}
user={{ ...user, id: objectId(user) }}
/>
))} ))}
<ConditionallyRender <ConditionallyRender
condition={users.length > avatarLimit} condition={users.length > avatarLimit}

View File

@ -18,7 +18,6 @@ const useOwnersMap = () => {
name: string; name: string;
imageUrl?: string; imageUrl?: string;
email?: string; email?: string;
description?: string;
} => { } => {
if (owner.ownerType === 'user') { if (owner.ownerType === 'user') {
return { return {
@ -30,12 +29,10 @@ const useOwnersMap = () => {
if (owner.ownerType === 'group') { if (owner.ownerType === 'group') {
return { return {
name: owner.name, name: owner.name,
description: 'group',
}; };
} }
return { return {
name: '', name: 'System',
description: 'System',
imageUrl: `${uiConfig.unleashUrl}/logo-unleash.png`, imageUrl: `${uiConfig.unleashUrl}/logo-unleash.png`,
}; };
}; };
@ -76,11 +73,7 @@ export const ProjectOwners: FC<IProjectOwnersProps> = ({ owners = [] }) => {
</StyledContainer> </StyledContainer>
<ConditionallyRender <ConditionallyRender
condition={owners.length === 1} condition={owners.length === 1}
show={ show={<StyledUserName>{users[0]?.name}</StyledUserName>}
<StyledUserName>
{users[0]?.name || users[0]?.description}
</StyledUserName>
}
elseShow={<div />} elseShow={<div />}
/> />
</> </>