Skip to content
Closed
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
6 changes: 3 additions & 3 deletions src/libs/IOUUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ function formatCurrentUserToAttendee(currentUser?: PersonalDetails, reportID?: s
return;
}
const initialAttendee: Attendee = {
email: currentUser?.login,
avatarUrl: currentUser.avatar?.toString() ?? '',
email: currentUser?.login ?? '',
login: currentUser?.login,
displayName: currentUser.displayName,
avatarUrl: currentUser.avatar?.toString(),
displayName: currentUser.displayName ?? '',
accountID: currentUser.accountID,
text: currentUser.login,
selected: true,
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ type OptimisticTaskReport = SetRequired<
type TransactionDetails = {
created: string;
amount: number;
attendees: Attendee[];
attendees: Attendee[] | string;
taxAmount?: number;
taxCode?: string;
currency: string;
Expand Down
4 changes: 2 additions & 2 deletions src/libs/TransactionUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,10 @@ function isMerchantMissing(transaction: OnyxEntry<Transaction>) {

// eslint-disable-next-line @typescript-eslint/no-unused-vars
function shouldShowAttendees(iouType: IOUType, policy: OnyxEntry<Policy>): boolean {
return false;
// return false;
// To be renabled once feature is complete: https://github.com/Expensify/App/issues/44725
// Keep this disabled for per diem expense
// return iouType === CONST.IOU.TYPE.SUBMIT && !!policy?.id && (policy?.type === CONST.POLICY.TYPE.CORPORATE || policy?.type === CONST.POLICY.TYPE.TEAM);
return iouType === CONST.IOU.TYPE.SUBMIT && !!policy?.id && (policy?.type === CONST.POLICY.TYPE.CORPORATE || policy?.type === CONST.POLICY.TYPE.TEAM);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3678,6 +3678,9 @@ function getUpdateMoneyRequestParams(
});
}
}
if (Array.isArray(params?.attendees)) {
params.attendees = JSON.stringify(params?.attendees);
}

// Clear out the error fields and loading states on success
successData.push({
Expand Down
5 changes: 4 additions & 1 deletion src/pages/iou/request/MoneyRequestAttendeeSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
import usePolicy from '@hooks/usePolicy';
import useScreenWrapperTranstionStatus from '@hooks/useScreenWrapperTransitionStatus';
import useThemeStyles from '@hooks/useThemeStyles';
import * as DeviceCapabilities from '@libs/DeviceCapabilities';

Check failure on line 19 in src/pages/iou/request/MoneyRequestAttendeeSelector.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @libs are not allowed. Use named imports instead. Example: import { method } from "@libs/module"
import * as OptionsListUtils from '@libs/OptionsListUtils';

Check failure on line 20 in src/pages/iou/request/MoneyRequestAttendeeSelector.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @libs are not allowed. Use named imports instead. Example: import { method } from "@libs/module"
import * as PolicyUtils from '@libs/PolicyUtils';

Check failure on line 21 in src/pages/iou/request/MoneyRequestAttendeeSelector.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @libs are not allowed. Use named imports instead. Example: import { method } from "@libs/module"
import * as Report from '@userActions/Report';

Check failure on line 22 in src/pages/iou/request/MoneyRequestAttendeeSelector.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @userActions are not allowed. Use named imports instead. Example: import { action } from "@userActions/module"
import type {IOUAction, IOUType} from '@src/CONST';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -146,7 +146,7 @@

const formatResults = OptionsListUtils.formatSectionsFromSearchTerm(
debouncedSearchTerm,
attendees.map((attendee) => ({...attendee, reportID: attendee.reportID ?? '-1'})),

Check failure on line 149 in src/pages/iou/request/MoneyRequestAttendeeSelector.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

chatOptions.recentReports,
chatOptions.personalDetails,
personalDetails,
Expand All @@ -168,7 +168,7 @@

if (
chatOptions.userToInvite &&
!OptionsListUtils.isCurrentUser({...chatOptions.userToInvite, accountID: chatOptions.userToInvite?.accountID ?? -1, status: chatOptions.userToInvite?.status ?? undefined})

Check failure on line 171 in src/pages/iou/request/MoneyRequestAttendeeSelector.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

) {
newSections.push({
title: undefined,
Expand Down Expand Up @@ -219,12 +219,15 @@
newSelectedOptions = [
...attendees,
{
accountID: option.accountID ?? -1,

Check failure on line 222 in src/pages/iou/request/MoneyRequestAttendeeSelector.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
login: option.login || option.text,
displayName: option.text,
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
email: option.login || (option.text ?? ''),
displayName: option.text ?? '',
selected: true,
searchText: option.searchText,
avatarUrl: option.avatarUrl ?? '',
iouType,
},
];
Expand Down Expand Up @@ -291,7 +294,7 @@
return (
<SelectionList
onConfirm={handleConfirmSelection}
sections={areOptionsInitialized ? sections : CONST.EMPTY_ARRAY}

Check failure on line 297 in src/pages/iou/request/MoneyRequestAttendeeSelector.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Type 'readonly never[] | Section[]' is not assignable to type 'readonly never[] | SectionListDataType<Attendee>[]'.
ListItem={InviteMemberListItem}
textInputValue={searchTerm}
textInputLabel={translate('selectionList.nameEmailOrPhoneNumber')}
Expand Down
6 changes: 3 additions & 3 deletions src/types/onyx/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ type IOU = {
/** Model of IOU attendee */
type Attendee = {
/** IOU attendee email */
email?: string;
email: string;

/** IOU attendee display name */
displayName?: string;
displayName: string;

/** IOU attendee avatar url */
avatarUrl?: string;
avatarUrl: string;

/** Account ID */
accountID?: number;
Expand Down
4 changes: 4 additions & 0 deletions src/types/onyx/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ type Comment = {

/** Violations that were dismissed */
dismissedViolations?: Partial<Record<ViolationName, Record<string, string | number>>>;

/** Selected attendees */
attendees?: Attendee[];
};

/** Model of transaction custom unit */
Expand Down Expand Up @@ -383,6 +386,7 @@ type Transaction = OnyxCommon.OnyxValueWithOfflineFeedback<
amount: number;

/** Selected attendees */
// TODO move inside `Comment` type
attendees?: Attendee[];

/** The transaction tax amount */
Expand Down
Loading