Skip to content

Commit

Permalink
add more fixes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
Kicu committed Apr 19, 2024
1 parent d42fc2d commit 674af05
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function Avatar({

// We pass the color styles down to the SVG for the workspace and fallback avatar.
const source = isWorkspace ? originalSource : UserUtils.getAvatar(originalSource, accountID);
const useFallBackAvatar = imageError || !originalSource || !source || source === Expensicons.FallbackAvatar;
const useFallBackAvatar = imageError || !source || source === Expensicons.FallbackAvatar;
const fallbackAvatar = isWorkspace ? ReportUtils.getDefaultWorkspaceAvatar(name) : fallbackIcon || Expensicons.FallbackAvatar;
const fallbackAvatarTestID = isWorkspace ? ReportUtils.getDefaultWorkspaceAvatarTestID(name) : fallbackIconTestID || 'SvgFallbackAvatar Icon';
const avatarSource = useFallBackAvatar ? fallbackAvatar : source;
Expand Down
7 changes: 1 addition & 6 deletions src/libs/UserUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function getDefaultAvatarURL(accountID: string | number = ''): string {
}

/**
* Given a user's avatar path, returns true if user doesn't have an avatar or if URL points to a default avatar
* Given a user's avatar path, returns true if URL points to a default avatar, false otherwise
* @param avatarSource - the avatar source from user's personalDetails
*/
function isDefaultAvatar(avatarSource?: AvatarSource): avatarSource is string | undefined {
Expand All @@ -137,11 +137,6 @@ function isDefaultAvatar(avatarSource?: AvatarSource): avatarSource is string |
}
}

if (!avatarSource) {
// If source is undefined, we should also use a default avatar
return true;
}

return false;
}

Expand Down

0 comments on commit 674af05

Please sign in to comment.