-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Fix/37448: Incorrect title thread #38267
Changes from 5 commits
e5a4710
c3210dd
8ca3778
f92c833
475f300
7089e82
f5a2eff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,11 +56,13 @@ import * as store from './actions/ReimbursementAccount/store'; | |
import * as CollectionUtils from './CollectionUtils'; | ||
import * as CurrencyUtils from './CurrencyUtils'; | ||
import DateUtils from './DateUtils'; | ||
import originalGetReportPolicyID from './getReportPolicyID'; | ||
import isReportMessageAttachment from './isReportMessageAttachment'; | ||
import localeCompare from './LocaleCompare'; | ||
import * as LocalePhoneNumber from './LocalePhoneNumber'; | ||
import * as Localize from './Localize'; | ||
import {isEmailPublicDomain} from './LoginUtils'; | ||
import ModifiedExpenseMessage from './ModifiedExpenseMessage'; | ||
import linkingConfig from './Navigation/linkingConfig'; | ||
import Navigation from './Navigation/Navigation'; | ||
import * as NumberUtils from './NumberUtils'; | ||
|
@@ -2642,6 +2644,9 @@ function getReportName(report: OnyxEntry<Report>, policy: OnyxEntry<Policy> = nu | |
if (parentReportActionMessage && isArchivedRoom(report)) { | ||
return `${parentReportActionMessage} (${Localize.translateLocal('common.archived')})`; | ||
} | ||
if (ReportActionsUtils.isModifiedExpenseAction(parentReportAction)) { | ||
return ModifiedExpenseMessage.getForReportAction(report?.reportID, parentReportAction); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should have used |
||
} | ||
return parentReportActionMessage; | ||
} | ||
|
||
|
@@ -4440,7 +4445,7 @@ function getReportIDFromLink(url: string | null): string { | |
* Get the report policyID given a reportID | ||
*/ | ||
function getReportPolicyID(reportID?: string): string | undefined { | ||
return getReport(reportID)?.policyID; | ||
return originalGetReportPolicyID(reportID); | ||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see that this is to avoid cycle dependency. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added comment |
||
import Onyx from 'react-native-onyx'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import type {Report} from '@src/types/onyx'; | ||
import type {EmptyObject} from '@src/types/utils/EmptyObject'; | ||
|
||
let allReports: OnyxCollection<Report>; | ||
Onyx.connect({ | ||
key: ONYXKEYS.COLLECTION.REPORT, | ||
waitForCollectionCallback: true, | ||
callback: (value) => (allReports = value), | ||
}); | ||
|
||
/** | ||
* Get the report given a reportID | ||
*/ | ||
function getReport(reportID: string | undefined): OnyxEntry<Report> | EmptyObject { | ||
if (!allReports) { | ||
return {}; | ||
} | ||
|
||
return allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`] ?? {}; | ||
} | ||
|
||
/** | ||
* Get the report policyID given a reportID | ||
*/ | ||
function getReportPolicyID(reportID?: string): string | undefined { | ||
return getReport(reportID)?.policyID; | ||
} | ||
|
||
export default getReportPolicyID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like updating type of reportAction here.
If this causes TS error in other place, fix it to match
OnyxEntry<ReportAction>
instead of fixing here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I am fine with this as already existing pattern in other place