Skip to content

Commit 451d89a

Browse files
fix lint
1 parent 4e2d644 commit 451d89a

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

src/libs/ReportUtils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1040,8 +1040,8 @@ function isSettled(reportOrID: OnyxInputOrEntry<Report> | SearchReport | string
10401040
/**
10411041
* Whether the current user is the submitter of the report
10421042
*/
1043-
function isCurrentUserSubmitter(reportID: string): boolean {
1044-
if (!allReports) {
1043+
function isCurrentUserSubmitter(reportID: string | undefined): boolean {
1044+
if (!allReports || !reportID) {
10451045
return false;
10461046
}
10471047
const report = allReports[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];

src/pages/home/HeaderView.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ function HeaderView({report, parentReportAction, reportID, onNavigationMenuButto
7070
const {isSmallScreenWidth} = useResponsiveLayout();
7171
const route = useRoute();
7272
const [isDeleteTaskConfirmModalVisible, setIsDeleteTaskConfirmModalVisible] = React.useState(false);
73-
const [invoiceReceiverPolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report?.invoiceReceiver && 'policyID' in report.invoiceReceiver ? report.invoiceReceiver.policyID : -1}`);
73+
const [invoiceReceiverPolicy] = useOnyx(
74+
`${ONYXKEYS.COLLECTION.POLICY}${report?.invoiceReceiver && 'policyID' in report.invoiceReceiver ? report.invoiceReceiver.policyID : CONST.DEFAULT_NUMBER_ID}`,
75+
);
7476
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
75-
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID || report?.reportID || '-1'}`);
77+
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID || report?.reportID}`);
7678
const policy = usePolicy(report?.policyID);
7779
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
7880

@@ -100,7 +102,7 @@ function HeaderView({report, parentReportAction, reportID, onNavigationMenuButto
100102
const reportDescription = Parser.htmlToText(ReportUtils.getReportDescription(report));
101103
const policyName = ReportUtils.getPolicyName(report, true);
102104
const policyDescription = ReportUtils.getPolicyDescriptionText(policy);
103-
const isPersonalExpenseChat = isPolicyExpenseChat && ReportUtils.isCurrentUserSubmitter(report?.reportID ?? '');
105+
const isPersonalExpenseChat = isPolicyExpenseChat && ReportUtils.isCurrentUserSubmitter(report?.reportID);
104106
const shouldShowSubtitle = () => {
105107
if (!subtitle) {
106108
return false;
@@ -258,7 +260,7 @@ function HeaderView({report, parentReportAction, reportID, onNavigationMenuButto
258260
<PressableWithoutFeedback
259261
onPress={() => {
260262
if (ReportUtils.canEditPolicyDescription(policy)) {
261-
Navigation.navigate(ROUTES.WORKSPACE_PROFILE_DESCRIPTION.getRoute(report.policyID ?? '-1'));
263+
Navigation.navigate(ROUTES.WORKSPACE_PROFILE_DESCRIPTION.getRoute(`${report.policyID ?? CONST.DEFAULT_NUMBER_ID}`));
262264
return;
263265
}
264266
Navigation.navigate(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(reportID, Navigation.getReportRHPActiveRoute()));

src/pages/iou/request/step/IOURequestStepScan/index.native.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ function IOURequestStepScan({
7474
const [startLocationPermissionFlow, setStartLocationPermissionFlow] = useState(false);
7575
const [fileResize, setFileResize] = useState<null | FileObject>(null);
7676
const [fileSource, setFileSource] = useState('');
77-
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID ?? -1}`);
77+
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID ?? CONST.DEFAULT_NUMBER_ID}`);
7878
const policy = usePolicy(report?.policyID);
7979
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
80-
const [skipConfirmation] = useOnyx(`${ONYXKEYS.COLLECTION.SKIP_CONFIRMATION}${transactionID ?? -1}`);
80+
const [skipConfirmation] = useOnyx(`${ONYXKEYS.COLLECTION.SKIP_CONFIRMATION}${transactionID ?? CONST.DEFAULT_NUMBER_ID}`);
8181
const platform = getPlatform(true);
8282
const [mutedPlatforms = {}] = useOnyx(ONYXKEYS.NVP_MUTED_PLATFORMS);
8383
const isPlatformMuted = mutedPlatforms[platform];
@@ -298,7 +298,7 @@ function IOURequestStepScan({
298298
// be added to the transaction (taken from the chat report participants) and then the person is taken to the confirmation step.
299299
const selectedParticipants = IOU.setMoneyRequestParticipantsFromReport(transactionID, report);
300300
const participants = selectedParticipants.map((participant) => {
301-
const participantAccountID = participant?.accountID ?? -1;
301+
const participantAccountID = participant?.accountID ?? CONST.DEFAULT_NUMBER_ID;
302302
return participantAccountID ? OptionsListUtils.getParticipantsOption(participant, personalDetails) : OptionsListUtils.getReportOption(participant);
303303
});
304304

@@ -311,10 +311,10 @@ function IOURequestStepScan({
311311
IOU.startSplitBill({
312312
participants,
313313
currentUserLogin: currentUserPersonalDetails?.login ?? '',
314-
currentUserAccountID: currentUserPersonalDetails?.accountID ?? -1,
314+
currentUserAccountID: currentUserPersonalDetails?.accountID ?? CONST.DEFAULT_NUMBER_ID,
315315
comment: '',
316316
receipt,
317-
existingSplitChatReportID: reportID ?? -1,
317+
existingSplitChatReportID: reportID ?? CONST.DEFAULT_NUMBER_ID,
318318
billable: false,
319319
category: '',
320320
tag: '',

src/pages/iou/request/step/IOURequestStepScan/index.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ function IOURequestStepScan({
8686
const [isQueriedPermissionState, setIsQueriedPermissionState] = useState(false);
8787

8888
const getScreenshotTimeoutRef = useRef<NodeJS.Timeout | null>(null);
89-
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID ?? -1}`);
89+
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID ?? CONST.DEFAULT_NUMBER_ID}`);
9090
const policy = usePolicy(report?.policyID);
9191
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
92-
const [skipConfirmation] = useOnyx(`${ONYXKEYS.COLLECTION.SKIP_CONFIRMATION}${transactionID ?? -1}`);
92+
const [skipConfirmation] = useOnyx(`${ONYXKEYS.COLLECTION.SKIP_CONFIRMATION}${transactionID ?? CONST.DEFAULT_NUMBER_ID}`);
9393
const [isLoadingReceipt, setIsLoadingReceipt] = useState(false);
9494

9595
const [videoConstraints, setVideoConstraints] = useState<MediaTrackConstraints>();
@@ -324,7 +324,7 @@ function IOURequestStepScan({
324324
// be added to the transaction (taken from the chat report participants) and then the person is taken to the confirmation step.
325325
const selectedParticipants = IOU.setMoneyRequestParticipantsFromReport(transactionID, report);
326326
const participants = selectedParticipants.map((participant) => {
327-
const participantAccountID = participant?.accountID ?? -1;
327+
const participantAccountID = participant?.accountID ?? CONST.DEFAULT_NUMBER_ID;
328328
return participantAccountID ? OptionsListUtils.getParticipantsOption(participant, personalDetails) : OptionsListUtils.getReportOption(participant);
329329
});
330330

@@ -337,10 +337,10 @@ function IOURequestStepScan({
337337
IOU.startSplitBill({
338338
participants,
339339
currentUserLogin: currentUserPersonalDetails?.login ?? '',
340-
currentUserAccountID: currentUserPersonalDetails?.accountID ?? -1,
340+
currentUserAccountID: currentUserPersonalDetails?.accountID ?? CONST.DEFAULT_NUMBER_ID,
341341
comment: '',
342342
receipt,
343-
existingSplitChatReportID: reportID ?? -1,
343+
existingSplitChatReportID: reportID ?? CONST.DEFAULT_NUMBER_ID,
344344
billable: false,
345345
category: '',
346346
tag: '',

0 commit comments

Comments
 (0)