Skip to content

Commit

Permalink
Username component shouldn't show email unless explicitly requested
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwoberts committed Sep 29, 2024
1 parent 761cb11 commit 4aecc0e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion public/components/common/UserName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ interface UserNameProps {
role?: UserRole
email?: string
}
showEmail?: boolean
}

export const UserName = (props: UserNameProps) => {
Expand All @@ -23,7 +24,7 @@ export const UserName = (props: UserNameProps) => {
return (
<div className={className}>
<span>{props.user.name || "Anonymous"}</span>
<>{props.user.email && <span className="c-username--email">({props.user.email})</span>}</>
<>{props.showEmail && props.user.email && <span className="c-username--email">({props.user.email})</span>}</>

{isStaff && (
<div data-tooltip={isStaff ? "Staff" : undefined}>
Expand Down
2 changes: 1 addition & 1 deletion public/pages/Administration/pages/ManageMembers.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const UserListItem = (props: UserListItemProps) => {
<HStack spacing={4}>
<Avatar user={props.user} />
<VStack spacing={0}>
<UserName user={props.user} />
<UserName user={props.user} showEmail={true}/>
<span className="text-muted">
{admin} {collaborator} {blocked}
</span>
Expand Down
2 changes: 1 addition & 1 deletion public/pages/ShowPost/components/VotesModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const VotesModal: React.FC<VotesModalProps> = (props) => {
<HStack>
<Avatar user={x.user} />
<VStack spacing={0}>
<UserName user={{ ...x.user, email: "" }} />
<UserName user={x.user} />
<span className="text-muted">{x.user.email}</span>
</VStack>
</HStack>
Expand Down

0 comments on commit 4aecc0e

Please sign in to comment.