Skip to content

Commit

Permalink
user: Render placeholder in UserAvatar for unknown user
Browse files Browse the repository at this point in the history
  • Loading branch information
gnprice committed Nov 10, 2023
1 parent a230134 commit da3a572
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/common/UserAvatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { IconUserBlank } from './Icons';
import { ThemeContext } from '../styles';

type Props = $ReadOnly<{|
avatarUrl: AvatarURL,
avatarUrl: AvatarURL | null,
size: number,
isMuted?: boolean,
children?: Node,
Expand Down Expand Up @@ -46,7 +46,7 @@ function UserAvatar(props: Props): Node {
const auth = useSelector(state => getAuth(state));

let userImage;
if (isMuted) {
if (isMuted || !avatarUrl) {
userImage = <IconUserBlank size={size} color={color} style={iconStyle} />;
} else {
userImage = (
Expand Down
2 changes: 1 addition & 1 deletion src/common/UserAvatarWithPresence.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function UserAvatarWithPresence(props: Props): Node {

if (!user) {
logging.warn("UserAvatarWithPresence: couldn't find user for ID", { userId });
return null;
return <UserAvatar avatarUrl={null} size={size} isMuted onPress={undefined} />;
}

return (
Expand Down

0 comments on commit da3a572

Please sign in to comment.