Skip to content

Commit

Permalink
fix lint issue after refactor ReportUtils to ts
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanDylann committed Nov 27, 2023
1 parent 30fcc76 commit de6787e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Str from 'expensify-common/lib/str';
import {isEmpty} from 'lodash';
import lodashEscape from 'lodash/escape';
import lodashFindLastIndex from 'lodash/findLastIndex';
import lodashGet from 'lodash/get';
import lodashIntersection from 'lodash/intersection';
import lodashIsEqual from 'lodash/isEqual';
import Onyx, {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx';
Expand All @@ -16,7 +15,7 @@ import CONST from '@src/CONST';
import {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import {Beta, Login, PersonalDetails, Policy, PolicyTags, Report, ReportAction, Transaction} from '@src/types/onyx';
import {Beta, Login, PersonalDetails, Policy, PolicyTags, Report, ReportAction, Session, Transaction} from '@src/types/onyx';
import {Errors, Icon, PendingAction} from '@src/types/onyx/OnyxCommon';
import {ChangeLog, IOUMessage, OriginalMessageActionName} from '@src/types/onyx/OriginalMessage';
import {Message, ReportActions} from '@src/types/onyx/ReportAction';
Expand Down Expand Up @@ -4220,13 +4219,14 @@ function shouldDisableWelcomeMessage(report: OnyxEntry<Report>, policy: OnyxEntr

/**
* Navigates to the appropriate screen based on the presence of a private note for the current user.
* @param {Object} report
* @param {Object} session
*/
function navigateToPrivateNotes(report, session) {
const currentUserPrivateNote = lodashGet(report, ['privateNotes', session.accountID, 'note'], '');
function navigateToPrivateNotes(report: Report, session: Session) {
if (isEmpty(report) || isEmpty(session)) {
return;
}
const currentUserPrivateNote = report.privateNotes?.[String(session.accountID)]?.note ?? '';
if (isEmpty(currentUserPrivateNote)) {
Navigation.navigate(ROUTES.PRIVATE_NOTES_EDIT.getRoute(report.reportID, session.accountID));
Navigation.navigate(ROUTES.PRIVATE_NOTES_EDIT.getRoute(report.reportID, String(session.accountID)));
return;
}
Navigation.navigate(ROUTES.PRIVATE_NOTES_LIST.getRoute(report.reportID));
Expand Down
1 change: 1 addition & 0 deletions src/types/onyx/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ type Report = {
isChatRoom?: boolean;
participantsList?: Array<Partial<PersonalDetails>>;
text?: string;
privateNotes?: Record<string, {note: string}>;
};

export default Report;

0 comments on commit de6787e

Please sign in to comment.