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 6 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: 1 addition & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ const CONST = {
FIRST_RESPONDER: Number(Config?.EXPENSIFY_ACCOUNT_ID_FIRST_RESPONDER ?? 9375152),
HELP: Number(Config?.EXPENSIFY_ACCOUNT_ID_HELP ?? -1),
INTEGRATION_TESTING_CREDS: Number(Config?.EXPENSIFY_ACCOUNT_ID_INTEGRATION_TESTING_CREDS ?? -1),
NOTIFICATIONS: Number(Config?.EXPENSIFY_ACCOUNT_ID_NOTIFICATIONS ?? 11665625),
NOTIFICATIONS: Number(11665625),
Gonals marked this conversation as resolved.
Show resolved Hide resolved
PAYROLL: Number(Config?.EXPENSIFY_ACCOUNT_ID_PAYROLL ?? 9679724),
QA: Number(Config?.EXPENSIFY_ACCOUNT_ID_QA ?? 3126513),
QA_TRAVIS: Number(Config?.EXPENSIFY_ACCOUNT_ID_QA_TRAVIS ?? 8595733),
Expand Down
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 @@ -237,6 +238,7 @@ export {
NewExpensify,
NewWindow,
NewWorkspace,
NotificationsAvatar,
Offline,
OfflineCloud,
OldDotWireframe,
Expand Down
1 change: 0 additions & 1 deletion src/components/ReportActionItem/MoneyRequestPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ function MoneyRequestPreview({
if (isEmptyObject(iouReport) && !isBillSplit) {
return null;
}

Gonals marked this conversation as resolved.
Show resolved Hide resolved
const sessionAccountID = session?.accountID;
const managerID = iouReport?.managerID ?? -1;
const ownerAccountID = iouReport?.ownerAccountID ?? -1;
Expand Down
8 changes: 8 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1600,6 +1600,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 @@ -4,7 +4,7 @@ import type {OnyxEntry} from 'react-native-onyx';
import Onyx 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 ONYXKEYS from '@src/ONYXKEYS';
import type {PersonalDetailsList} from '@src/types/onyx';
Expand Down Expand Up @@ -98,6 +98,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