Skip to content

Commit

Permalink
Merge pull request #36422 from Expensify/alberto-notificationsName
Browse files Browse the repository at this point in the history
Display correct name and avatar for notifications@expensify.com
  • Loading branch information
Hayata Suenaga authored Feb 20, 2024
2 parents 12fc2cb + 0041154 commit 299576f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
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 @@ -247,6 +248,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 @@ -1623,6 +1623,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

0 comments on commit 299576f

Please sign in to comment.