Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display correct name and avatar for [email protected] #36422

Merged
merged 8 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions assets/images/avatars/notifications-avatar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/components/Icon/Expensicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import DeletedRoomAvatar from '@assets/images/avatars/deleted-room.svg';
import DomainRoomAvatar from '@assets/images/avatars/domain-room.svg';
import FallbackAvatar from '@assets/images/avatars/fallback-avatar.svg';
import FallbackWorkspaceAvatar from '@assets/images/avatars/fallback-workspace-avatar.svg';
import NotificationsAvatar from '@assets/images/avatars/notifications-avatar.svg';
import ActiveRoomAvatar from '@assets/images/avatars/room.svg';
import BackArrow from '@assets/images/back-left.svg';
import Bank from '@assets/images/bank.svg';
Expand Down Expand Up @@ -248,6 +249,7 @@ export {
ExpensifyLogoNew,
NewWindow,
NewWorkspace,
NotificationsAvatar,
Offline,
OfflineCloud,
OldDotWireframe,
Expand Down
8 changes: 8 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1616,6 +1616,14 @@ function getPersonalDetailsForAccountID(accountID: number): Partial<PersonalDeta
avatar: UserUtils.getDefaultAvatar(accountID),
};
}
if (Number(accountID) === CONST.ACCOUNT_ID.NOTIFICATIONS) {
return {
accountID,
displayName: 'Expensify',
login: CONST.EMAIL.NOTIFICATIONS,
avatar: UserUtils.getDefaultAvatar(accountID),
};
}
return (
allPersonalDetails?.[accountID] ?? {
avatar: UserUtils.getDefaultAvatar(accountID),
Expand Down
5 changes: 4 additions & 1 deletion src/libs/UserUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Str from 'expensify-common/lib/str';
import type {OnyxEntry} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import * as defaultAvatars from '@components/Icon/DefaultAvatars';
import {ConciergeAvatar, FallbackAvatar} from '@components/Icon/Expensicons';
import {ConciergeAvatar, FallbackAvatar, NotificationsAvatar} from '@components/Icon/Expensicons';
import CONST from '@src/CONST';
import type Login from '@src/types/onyx/Login';
import type IconAsset from '@src/types/utils/IconAsset';
Expand Down Expand Up @@ -88,6 +88,9 @@ function getDefaultAvatar(accountID = -1, avatarURL?: string): IconAsset {
if (Number(accountID) === CONST.ACCOUNT_ID.CONCIERGE) {
return ConciergeAvatar;
}
if (Number(accountID) === CONST.ACCOUNT_ID.NOTIFICATIONS) {
return NotificationsAvatar;
}

// There are 24 possible default avatars, so we choose which one this user has based
// on a simple modulo operation of their login number. Note that Avatar count starts at 1.
Expand Down
Loading