Tooltip: Spiffier 4 users list (#6730)

This commit is contained in:
RachelElysia 2022-07-19 15:13:20 -04:00 committed by GitHub
parent c42b9e550a
commit 1c1bec12d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -81,11 +81,16 @@ const condenseDeviceUsers = (users: IDeviceUser[]): string[] => {
return [];
}
const condensed =
users
.slice(-3)
.map((u) => u.email)
.reverse() || [];
return users.length > 3
users.length === 4
? users
.slice(-4)
.map((u) => u.email)
.reverse()
: users
.slice(-3)
.map((u) => u.email)
.reverse() || [];
return users.length > 4
? condensed.concat(`+${users.length - 3} more`) // TODO: confirm limit
: condensed;
};