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

[NO QA] Merge the attendee tracking changes, but block use #51329

Merged
merged 69 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
93edf8b
Enable name in the filter function
zfurtak Jul 23, 2024
a53c355
Blank commit
zfurtak Jul 23, 2024
34d58c6
Merge branch 'main' into @zfurtak/atendee-tracking-enable-names-selec…
zfurtak Jul 23, 2024
fc456f3
Added shouldAcceptName prop
zfurtak Jul 25, 2024
7b8649a
Merge branch 'main' into @zfurtak/enables-plain-string
zfurtak Aug 14, 2024
cb2e4f0
Merge branch 'main' into screen
robertKozik Aug 22, 2024
d2bf2d5
create new route for attendee screen
robertKozik Aug 26, 2024
a355c43
create attendee screen + selector
robertKozik Aug 26, 2024
ae38408
WIP: temporary access attendee from merchant option
robertKozik Aug 26, 2024
d1eb72c
Added translations
zfurtak Aug 26, 2024
79d0d00
Merge branch 'main' into attendee-47171
zfurtak Aug 26, 2024
1c248a1
Changed type to Attendee
zfurtak Aug 26, 2024
a6ae379
Merge branch 'main' into attendee-47171
zfurtak Aug 27, 2024
1d91de1
WIP
zfurtak Aug 28, 2024
923df86
Fix TS and Lint
filip-solecki Aug 28, 2024
21d8a88
Fix not existing user selection
filip-solecki Aug 28, 2024
da74588
Merge branch 'main' into attendee-47171
zfurtak Aug 28, 2024
db64c0a
Merge branch 'attendee-47171' of https://github.com/software-mansion-…
zfurtak Aug 28, 2024
2318920
Adjusted requestMoney function
zfurtak Aug 29, 2024
ea44c0c
Added saving attendees
zfurtak Aug 29, 2024
2d52cec
Merge branch 'main' into attendee-47171
zfurtak Aug 29, 2024
0716dff
Adjusted submitting expense with attendees
zfurtak Aug 29, 2024
56e365d
Fixed ts and lint errors
zfurtak Aug 29, 2024
29e2bfd
Added per person to attendee title
zfurtak Aug 29, 2024
d001c91
Added recents attendees
zfurtak Aug 30, 2024
a8e6354
Adjusted to review
zfurtak Aug 30, 2024
b4ee548
Merge branch 'main' into attendee-47171
zfurtak Sep 1, 2024
f88175a
Merge branch 'main' into attendee-47171
zfurtak Sep 1, 2024
6de6e0d
Adjusted to review
zfurtak Sep 1, 2024
dd1fb0a
Update src/libs/OptionsListUtils.ts
filip-solecki Sep 2, 2024
4668611
Use recentAttendees instead of recentReports and add creator to Recen…
filip-solecki Sep 3, 2024
a8eda3b
Fix creator selecting and unselecting
filip-solecki Sep 3, 2024
97dfef4
Set max recent attendees value to 5
filip-solecki Sep 4, 2024
b048b80
Move rest of recents to top of contacts
filip-solecki Sep 4, 2024
dadb5c2
Merge branch 'main' into attendee-47171
zfurtak Sep 4, 2024
50c006e
Merge branch 'attendee-47171' of https://github.com/software-mansion-…
zfurtak Sep 4, 2024
105bd76
Fixed React Compiler issue
zfurtak Sep 4, 2024
7641012
Merge pull request #48008 from software-mansion-labs/attendee-47171
Julesssss Sep 5, 2024
49456f0
WIP
zfurtak Sep 6, 2024
bb3a77c
Passed transaction to attendee edit screen
zfurtak Sep 6, 2024
430e8e5
add per attendee amount
SzymczakJ Sep 10, 2024
0e9ec1a
add reportAction message for change attendee
SzymczakJ Sep 11, 2024
4597970
Submitter bug fixed
zfurtak Sep 11, 2024
c1ea6c7
add violation recalculation
SzymczakJ Sep 12, 2024
91cbcb0
fix PR comments
SzymczakJ Sep 12, 2024
1d8f66f
fix attendee edit bugs
SzymczakJ Sep 12, 2024
38b0eca
prettify code
SzymczakJ Sep 12, 2024
23f6538
delete console logs
SzymczakJ Sep 12, 2024
97451de
Adjusted to review
zfurtak Sep 12, 2024
9002456
Merge main into branch
zfurtak Sep 16, 2024
e831785
Merge branch 'main' into @zfurtak/attendee-recents-fix
zfurtak Sep 16, 2024
c8ca2df
Merge branch 'main' into feature-attendeeTracking
Julesssss Sep 16, 2024
3d1c5ab
Merge with feature branch
zfurtak Sep 16, 2024
0cde5dd
Merge remote-tracking branch 'expensify/feature-attendeeTracking' int…
zfurtak Sep 16, 2024
2e4d632
Adjusted to review
zfurtak Sep 16, 2024
6bd365b
Adjusted to comment
zfurtak Sep 16, 2024
9f18d1a
Merge pull request #49008 from software-mansion-labs/@zfurtak/attende…
Julesssss Sep 16, 2024
d17cada
Merge pull request #48870 from software-mansion-labs/attendee-edit
Julesssss Sep 16, 2024
708c86a
Merge branch 'main' into feature-attendeeTracking
Julesssss Sep 23, 2024
ab87201
Merge branch 'main' into feature-attendeeTracking
Julesssss Oct 2, 2024
77bfd24
Merge branch 'main' into feature-attendeeTracking
Julesssss Oct 8, 2024
7297474
Merge branch 'main' into feature-attendeeTracking
Julesssss Oct 11, 2024
d2c625b
Merge branch 'main' into feature-attendeeTracking
Julesssss Oct 15, 2024
92a73c2
Merge branch 'main' into feature-attendeeTracking
Julesssss Oct 23, 2024
e82ef4e
disable feature while it is in progress
Julesssss Oct 23, 2024
4360e57
resolve ESLint issues
Julesssss Oct 23, 2024
13ba38b
Merge branch 'main' into feature-attendeeTracking
Julesssss Oct 24, 2024
9503d95
fix attendee violation
Julesssss Oct 24, 2024
d3b96df
remove unused const missed by conflict resolution
Julesssss Oct 24, 2024
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
48 changes: 48 additions & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,54 @@ const ROUTES = {
getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string, backTo = '') =>
getUrlWithBackToParam(`${action as string}/${iouType as string}/attendees/${transactionID}/${reportID}`, backTo),
},
SETTINGS_TAGS_ROOT: {
route: 'settings/:policyID/tags',
getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/tags`, backTo),
},
SETTINGS_TAGS_SETTINGS: {
route: 'settings/:policyID/tags/settings',
getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/tags/settings` as const, backTo),
},
SETTINGS_TAGS_EDIT: {
route: 'settings/:policyID/tags/:orderWeight/edit',
getRoute: (policyID: string, orderWeight: number, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/tags/${orderWeight}/edit` as const, backTo),
},
SETTINGS_TAG_CREATE: {
route: 'settings/:policyID/tags/new',
getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/tags/new` as const, backTo),
},
SETTINGS_TAG_EDIT: {
route: 'settings/:policyID/tag/:orderWeight/:tagName/edit',
getRoute: (policyID: string, orderWeight: number, tagName: string, backTo = '') =>
getUrlWithBackToParam(`settings/${policyID}/tag/${orderWeight}/${encodeURIComponent(tagName)}/edit` as const, backTo),
},
SETTINGS_TAG_SETTINGS: {
route: 'settings/:policyID/tag/:orderWeight/:tagName',
getRoute: (policyID: string, orderWeight: number, tagName: string, backTo = '') =>
getUrlWithBackToParam(`settings/${policyID}/tag/${orderWeight}/${encodeURIComponent(tagName)}` as const, backTo),
},
SETTINGS_TAG_APPROVER: {
route: 'settings/:policyID/tag/:orderWeight/:tagName/approver',
getRoute: (policyID: string, orderWeight: number, tagName: string, backTo = '') =>
getUrlWithBackToParam(`settings/${policyID}/tag/${orderWeight}/${encodeURIComponent(tagName)}/approver` as const, backTo),
},
SETTINGS_TAG_LIST_VIEW: {
route: 'settings/:policyID/tag-list/:orderWeight',
getRoute: (policyID: string, orderWeight: number, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/tag-list/${orderWeight}` as const, backTo),
},
SETTINGS_TAG_GL_CODE: {
route: 'settings/:policyID/tag/:orderWeight/:tagName/gl-code',
getRoute: (policyID: string, orderWeight: number, tagName: string, backTo = '') =>
getUrlWithBackToParam(`settings/${policyID}/tag/${orderWeight}/${encodeURIComponent(tagName)}/gl-code` as const, backTo),
},
SETTINGS_TAGS_IMPORT: {
route: 'settings/:policyID/tags/import',
getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/tags/import` as const, backTo),
},
SETTINGS_TAGS_IMPORTED: {
route: 'settings/:policyID/tags/imported',
getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/tags/imported` as const, backTo),
},
SETTINGS_CATEGORIES_ROOT: {
route: 'settings/:policyID/categories',
getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/categories`, backTo),
Expand Down
5 changes: 4 additions & 1 deletion src/components/MoneyRequestConfirmationListFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,10 @@ function MoneyRequestConfirmationListFooter({
},
{
item: (
<View style={[styles.flexRow, styles.justifyContentBetween, styles.alignItemsCenter, styles.ml5, styles.mr8, styles.optionRow]}>
<View
key={translate('common.billable')}
style={[styles.flexRow, styles.justifyContentBetween, styles.alignItemsCenter, styles.ml5, styles.mr8, styles.optionRow]}
>
<ToggleSettingOptionRow
switchAccessibilityLabel={translate('common.billable')}
title={translate('common.billable')}
Expand Down
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,8 @@ const translations = {
bookingArchived: 'This booking is archived',
bookingArchivedDescription: 'This booking is archived because the trip date has passed. Add an expense for the final amount if needed.',
attendees: 'Attendees',
paymentComplete: 'Payment complete',
justTrackIt: 'Just track it (don’t submit it)',
},
notificationPreferencesPage: {
header: 'Notification preferences',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,8 @@ const translations = {
bookingArchived: 'Esta reserva está archivada',
bookingArchivedDescription: 'Esta reserva está archivada porque la fecha del viaje ha pasado. Agregue un gasto por el monto final si es necesario.',
attendees: 'Asistentes',
paymentComplete: 'Pago completo',
justTrackIt: 'Solo guardarlo (no enviarlo)',
},
notificationPreferencesPage: {
header: 'Preferencias de avisos',
Expand Down
10 changes: 9 additions & 1 deletion src/libs/IOUUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@ function formatCurrentUserToAttendee(currentUser?: PersonalDetails, reportID?: s
return [initialAttendee];
}

function shouldStartLocationPermissionFlow() {
return (
!lastLocationPermissionPrompt ||
(DateUtils.isValidDateString(lastLocationPermissionPrompt ?? '') &&
DateUtils.getDifferenceInDaysFromNow(new Date(lastLocationPermissionPrompt ?? '')) > CONST.IOU.LOCATION_PERMISSION_PROMPT_THRESHOLD_DAYS)
);
}

export {
calculateAmount,
insertTagIntoTransactionTagsString,
Expand All @@ -190,6 +198,6 @@ export {
isValidMoneyRequestType,
navigateToStartMoneyRequestStep,
updateIOUOwnerAndTotal,
temporary_isValidMoneyRequestType,
formatCurrentUserToAttendee,
shouldStartLocationPermissionFlow,
};
1 change: 1 addition & 0 deletions src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2489,6 +2489,7 @@ function filterOptions(options: Options, searchInputValue: string, config?: Filt
preferChatroomsOverThreads = false,
preferPolicyExpenseChat = false,
shouldAcceptName = false,
preferRecentExpenseReports = false,
} = config ?? {};
// Remove the personal details for the DMs that are already in the recent reports so that we don't show duplicates
function filteredPersonalDetailsOfRecentReports(recentReports: ReportUtils.OptionData[], personalDetails: ReportUtils.OptionData[]) {
Expand Down
7 changes: 5 additions & 2 deletions src/libs/TransactionUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import type {IOURequestType} from '@userActions/IOU';
import CONST from '@src/CONST';
import type {IOUType} from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Beta, OnyxInputOrEntry, Policy, RecentWaypoint, ReviewDuplicates, TaxRate, TaxRates, Transaction, TransactionViolation, TransactionViolations} from '@src/types/onyx';
import type {Beta, OnyxInputOrEntry, Policy, RecentWaypoint, Report, ReviewDuplicates, TaxRate, TaxRates, Transaction, TransactionViolation, TransactionViolations} from '@src/types/onyx';
import type {Attendee} from '@src/types/onyx/IOU';
import type {Comment, Receipt, TransactionChanges, TransactionPendingFieldsKey, Waypoint, WaypointCollection} from '@src/types/onyx/Transaction';
import type DeepValueOf from '@src/types/utils/DeepValueOf';
Expand Down Expand Up @@ -211,8 +211,11 @@ function isMerchantMissing(transaction: OnyxEntry<Transaction>) {
return isMerchantEmpty;
}

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

/**
Expand Down
5 changes: 5 additions & 0 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2038,6 +2038,7 @@ function getMoneyRequestInformation(
moneyRequestReportID = '',
linkedTrackedExpenseReportAction?: OnyxTypes.ReportAction,
attendees?: Attendee[],
existingTransaction: OnyxEntry<OnyxTypes.Transaction> | undefined = undefined,
): MoneyRequestInformation {
const payerEmail = PhoneNumber.addSMSDomainIfPhoneNumber(participant.login ?? '');
const payerAccountID = Number(participant.accountID);
Expand Down Expand Up @@ -2757,6 +2758,9 @@ function getUpdateMoneyRequestParams(
}
}

const clearedPendingFields = Object.fromEntries(Object.keys(updatedTransaction?.pendingFields ?? transactionChanges).map((key) => [key, null]));

// Clear out the error fields and loading states on success
successData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
Expand Down Expand Up @@ -5280,6 +5284,7 @@ function createDistanceRequest(
currentUserEmail,
moneyRequestReportID,
undefined,
undefined,
existingTransaction,
);
onyxData = moneyRequestOnyxData;
Expand Down
169 changes: 76 additions & 93 deletions src/pages/iou/request/step/IOURequestStepScan/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ function IOURequestStepScan({
IOU.requestMoney(
report,
0,
transaction?.attendees,
transaction?.currency ?? 'USD',
transaction?.created ?? '',
'',
Expand All @@ -263,7 +264,7 @@ function IOURequestStepScan({
);
}
},
[currentUserPersonalDetails.accountID, currentUserPersonalDetails.login, iouType, report, transaction?.created, transaction?.currency],
[currentUserPersonalDetails.accountID, currentUserPersonalDetails.login, iouType, report, transaction?.attendees, transaction?.created, transaction?.currency],
);
const navigateToConfirmationStep = useCallback(
(file: FileObject, source: string, locationPermissionGranted = false) => {
Expand Down Expand Up @@ -309,105 +310,87 @@ function IOURequestStepScan({
});
return;
}
getCurrentPosition(
(successData) => {
if (iouType === CONST.IOU.TYPE.TRACK && report) {
IOU.trackExpense(
report,
0,
transaction?.currency ?? 'USD',
transaction?.created ?? '',
'',
currentUserPersonalDetails.login,
currentUserPersonalDetails.accountID,
participants[0],
'',
receipt,
'',
'',
'',
0,
false,
policy,
{},
{},
{
lat: successData.coords.latitude,
long: successData.coords.longitude,
},
);
} else {
IOU.requestMoney(
report,
0,
transaction?.attendees,
transaction?.currency ?? 'USD',
transaction?.created ?? '',
'',
currentUserPersonalDetails.login,
currentUserPersonalDetails.accountID,
participants[0],
'',
receipt,
'',
'',
'',
0,
false,
policy,
{},
{},
{
lat: successData.coords.latitude,
long: successData.coords.longitude,
},
);
}
},
(errorData) => {
Log.info('[IOURequestStepScan] getCurrentPosition failed', false, errorData);
// When there is an error, the money can still be requested, it just won't include the GPS coordinates
if (iouType === CONST.IOU.TYPE.TRACK && report) {
IOU.trackExpense(
report,
0,
transaction?.currency ?? 'USD',
transaction?.created ?? '',
'',
currentUserPersonalDetails.login,
currentUserPersonalDetails.accountID,
participants[0],
'',
receipt,
);
} else {
IOU.requestMoney(
report,
0,
transaction?.attendees,
transaction?.currency ?? 'USD',
transaction?.created ?? '',
'',
currentUserPersonalDetails.login,
currentUserPersonalDetails.accountID,
participants[0],
'',
receipt,
);
}
},
{
maximumAge: CONST.GPS.MAX_AGE,
timeout: CONST.GPS.TIMEOUT,
},
);
const participant = participants.at(0);
if (!participant) {
return;
}
if (locationPermissionGranted) {
getCurrentPosition(
(successData) => {
if (iouType === CONST.IOU.TYPE.TRACK && report) {
IOU.trackExpense(
report,
0,
transaction?.currency ?? 'USD',
transaction?.created ?? '',
'',
currentUserPersonalDetails.login,
currentUserPersonalDetails.accountID,
participant,
'',
receipt,
'',
'',
'',
0,
false,
policy,
{},
{},
{
lat: successData.coords.latitude,
long: successData.coords.longitude,
},
);
} else {
IOU.requestMoney(
report,
0,
transaction?.attendees,
transaction?.currency ?? 'USD',
transaction?.created ?? '',
'',
currentUserPersonalDetails.login,
currentUserPersonalDetails.accountID,
participant,
'',
receipt,
'',
'',
'',
0,
false,
policy,
{},
{},
{
lat: successData.coords.latitude,
long: successData.coords.longitude,
},
);
}
},
(errorData) => {
Log.info('[IOURequestStepScan] getCurrentPosition failed', false, errorData);
// When there is an error, the money can still be requested, it just won't include the GPS coordinates
createTransaction(receipt, participant);
},
{
maximumAge: CONST.GPS.MAX_AGE,
timeout: CONST.GPS.TIMEOUT,
},
);
return;
}
createTransaction(receipt, participant);
return;
}
navigateToConfirmationPage();
},
[
backTo,
transaction?.isFromGlobalCreate,
transaction?.attendees,
transaction?.currency,
transaction?.created,
iouType,
Expand Down
Loading
Loading