Skip to content
Merged
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
3 changes: 2 additions & 1 deletion src/components/Search/FilterDropdowns/InSelectPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ function InSelectPopup({closeOverlay, updateFilterForm}: InSelectPopupProps) {
const privateIsArchivedMap = usePrivateIsArchivedMap();
const [nvpDismissedProductTraining] = useOnyx(ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING);
const [policyTags] = useOnyx(ONYXKEYS.COLLECTION.POLICY_TAGS, {selector: passthroughPolicyTagListSelector});
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);

const selectedOptions: OptionData[] = selectedReportIDs.map((id) => {
const privateIsArchived = privateIsArchivedMap[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${id}`];
Expand All @@ -80,7 +81,7 @@ function InSelectPopup({closeOverlay, updateFilterForm}: InSelectPopupProps) {
const isReportArchived = !!privateIsArchived;
const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${reportData?.policyID}`];
const reportPolicyTags = policyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${getNonEmptyStringOnyxID(report?.policyID)}`];
const alternateText = getAlternateText(report, {}, {isReportArchived, policy, reportAttributesDerived, policyTags: reportPolicyTags});
const alternateText = getAlternateText(report, {}, {isReportArchived, policy, reportAttributesDerived, policyTags: reportPolicyTags, conciergeReportID});
return {...report, alternateText};
});

Expand Down
3 changes: 2 additions & 1 deletion src/components/Search/SearchFiltersChatsSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function SearchFiltersChatsSelector({initialReportIDs, onFiltersUpdate, isScreen
const [countryCode = CONST.DEFAULT_COUNTRY_CODE] = useOnyx(ONYXKEYS.COUNTRY_CODE);
const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST);
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const currentUserAccountID = currentUserPersonalDetails.accountID;
const currentUserEmail = currentUserPersonalDetails.email ?? '';
Expand All @@ -75,7 +76,7 @@ function SearchFiltersChatsSelector({initialReportIDs, onFiltersUpdate, isScreen
const report = getSelectedOptionData(createOptionFromReport({...reportData, reportID: id}, personalDetails, privateIsArchived, reportPolicy, reportAttributesDerived));
const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${reportData?.policyID}`];
const reportPolicyTags = policyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${getNonEmptyStringOnyxID(report?.policyID)}`];
const alternateText = getAlternateText(report, {}, {isReportArchived: privateIsArchived, policy, reportAttributesDerived, policyTags: reportPolicyTags});
const alternateText = getAlternateText(report, {}, {isReportArchived: privateIsArchived, policy, reportAttributesDerived, policyTags: reportPolicyTags, conciergeReportID});
return {...report, alternateText};
});

Expand Down
10 changes: 6 additions & 4 deletions src/hooks/useSearchSelector.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ function useSearchSelectorBase({
const currentUserEmail = currentUserPersonalDetails.email ?? '';
const personalDetails = usePersonalDetails();
const [allPolicyTags] = useOnyx(ONYXKEYS.COLLECTION.POLICY_TAGS, {selector: passthroughPolicyTagListSelector});
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);

const onListEndReached = useDebounce(
useCallback(() => {
Expand Down Expand Up @@ -240,7 +241,7 @@ function useSearchSelectorBase({
personalDetails,
});
case CONST.SEARCH_SELECTOR.SEARCH_CONTEXT_MEMBER_INVITE:
return getValidOptions(optionsWithContacts, allPolicies, draftComments, nvpDismissedProductTraining, loginList, currentUserAccountID, currentUserEmail, {
return getValidOptions(optionsWithContacts, allPolicies, draftComments, nvpDismissedProductTraining, loginList, currentUserAccountID, currentUserEmail, conciergeReportID, {
betas: betas ?? [],
includeP2P: true,
includeSelectedOptions: false,
Expand All @@ -261,7 +262,7 @@ function useSearchSelectorBase({
sortedActions,
});
case CONST.SEARCH_SELECTOR.SEARCH_CONTEXT_GENERAL:
return getValidOptions(optionsWithContacts, allPolicies, draftComments, nvpDismissedProductTraining, loginList, currentUserAccountID, currentUserEmail, {
return getValidOptions(optionsWithContacts, allPolicies, draftComments, nvpDismissedProductTraining, loginList, currentUserAccountID, currentUserEmail, conciergeReportID, {
betas: betas ?? [],
searchString: computedSearchTerm,
searchInputValue: trimmedSearchInput,
Expand All @@ -284,7 +285,7 @@ function useSearchSelectorBase({
...getValidOptionsConfig,
});
case CONST.SEARCH_SELECTOR.SEARCH_CONTEXT_SHARE_DESTINATION:
return getValidOptions(optionsWithContacts, allPolicies, draftComments, nvpDismissedProductTraining, loginList, currentUserAccountID, currentUserEmail, {
return getValidOptions(optionsWithContacts, allPolicies, draftComments, nvpDismissedProductTraining, loginList, currentUserAccountID, currentUserEmail, conciergeReportID, {
betas,
selectedOptions,
includeMultipleParticipantReports: true,
Expand All @@ -308,7 +309,7 @@ function useSearchSelectorBase({
sortedActions,
});
case CONST.SEARCH_SELECTOR.SEARCH_CONTEXT_ATTENDEES:
return getValidOptions(optionsWithContacts, allPolicies, draftComments, nvpDismissedProductTraining, loginList, currentUserAccountID, currentUserEmail, {
return getValidOptions(optionsWithContacts, allPolicies, draftComments, nvpDismissedProductTraining, loginList, currentUserAccountID, currentUserEmail, conciergeReportID, {
betas: betas ?? [],
includeP2P: true,
includeSelectedOptions: false,
Expand Down Expand Up @@ -348,6 +349,7 @@ function useSearchSelectorBase({
loginList,
currentUserAccountID,
currentUserEmail,
conciergeReportID,
personalDetails,
excludeLogins,
excludeFromSuggestionsOnly,
Expand Down
14 changes: 12 additions & 2 deletions src/libs/OptionsListUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
*/

let allReports: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 217 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -230,7 +230,7 @@
const deprecatedCachedOneTransactionThreadReportIDs: Record<string, string | undefined> = {};
/** @deprecated Use sortedReportActionsData from ONYXKEYS.DERIVED.RAM_ONLY_SORTED_REPORT_ACTIONS instead. Will be removed once all flows are migrated. */
let deprecatedAllReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 233 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand Down Expand Up @@ -280,7 +280,7 @@
});

let activePolicyID: OnyxEntry<string>;
Onyx.connect({

Check warning on line 283 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.NVP_ACTIVE_POLICY_ID,
callback: (value) => (activePolicyID = value),
});
Expand Down Expand Up @@ -438,6 +438,7 @@
translate?: LocalizedTranslate;
reportAttributesDerived?: ReportAttributesDerivedValue['reports'];
policyTags?: OnyxEntry<PolicyTagLists>;
conciergeReportID: string | undefined;
};

/**
Expand All @@ -446,7 +447,7 @@
function getAlternateText(
option: OptionData,
{showChatPreviewLine = false, forcePolicyNamePreview = false}: PreviewConfig,
{isReportArchived, policy, lastActorDetails = {}, visibleReportActionsData = {}, translate, reportAttributesDerived, policyTags}: GetAlternateTextConfig,
{isReportArchived, policy, lastActorDetails = {}, visibleReportActionsData = {}, translate, reportAttributesDerived, policyTags, conciergeReportID}: GetAlternateTextConfig,
) {
const report = getReportOrDraftReport(option.reportID);
const isAdminRoom = reportUtilsIsAdminRoom(report);
Expand All @@ -466,6 +467,7 @@
visibleReportActionsDataParam: visibleReportActionsData,
reportAttributesDerived,
policyTags,
conciergeReportID,
});
const reportPrefix = getReportSubtitlePrefix(report);
const formattedLastMessageTextWithPrefix = reportPrefix + formattedLastMessageText;
Expand Down Expand Up @@ -1106,6 +1108,7 @@
translate: translateFn,
reportAttributesDerived,
policyTags,
conciergeReportID,
},
);

Expand Down Expand Up @@ -2269,6 +2272,7 @@
policiesCollection: OnyxCollection<Policy>,
currentUserAccountID: number,
config: GetValidReportsConfig,
conciergeReportID: string | undefined,
visibleReportActionsData: VisibleReportActionsDerivedValue = {},
reportAttributesDerived?: ReportAttributesDerivedValue['reports'],
// eslint-disable-next-line @typescript-eslint/no-deprecated
Expand Down Expand Up @@ -2316,6 +2320,7 @@
visibleReportActionsData,
reportAttributesDerived,
policyTags: reportPolicyTags,
conciergeReportID,
},
);
const isSelected = isReportSelected(option, selectedOptions);
Expand Down Expand Up @@ -2438,6 +2443,7 @@
loginList: OnyxEntry<Login>,
currentUserAccountID: number,
currentUserEmail: string,
conciergeReportID: string | undefined,
Comment thread
rlinoz marked this conversation as resolved.
{
excludeLogins = {},
excludeFromSuggestionsOnly = {},
Expand Down Expand Up @@ -2564,6 +2570,7 @@
shouldShowGBR,
personalDetails,
},
conciergeReportID,
visibleReportActionsData,
reportAttributesDerived,
sortedActions,
Expand All @@ -2587,6 +2594,7 @@
shouldShowGBR,
personalDetails,
},
conciergeReportID,
visibleReportActionsData,
reportAttributesDerived,
sortedActions,
Expand All @@ -2606,6 +2614,7 @@
shouldShowGBR,
personalDetails,
},
conciergeReportID,
visibleReportActionsData,
reportAttributesDerived,
sortedActions,
Expand Down Expand Up @@ -2765,7 +2774,8 @@
personalDetails,
allPolicyTags,
}: SearchOptionsConfig): Options {
const optionList = getValidOptions(options, policyCollection, draftComments, nvpDismissedProductTraining, loginList, currentUserAccountID, currentUserEmail, {
// TODO: We'll pass the conciergeReportID eventually. Refactor issue: https://github.com/Expensify/App/issues/66411
const optionList = getValidOptions(options, policyCollection, draftComments, nvpDismissedProductTraining, loginList, currentUserAccountID, currentUserEmail, undefined, {
betas,
includeRecentReports,
includeMultipleParticipantReports: true,
Expand Down
2 changes: 2 additions & 0 deletions src/pages/NewChatPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function useOptions(reportAttributesDerived: ReportAttributesDerivedValue['repor
const isScreenFocusedRef = useIsFocusedRef();
const [sortedActions] = useOnyx(ONYXKEYS.DERIVED.RAM_ONLY_SORTED_REPORT_ACTIONS, {selector: sortedActionsSelector});
const [allPolicyTags] = useOnyx(ONYXKEYS.COLLECTION.POLICY_TAGS, {selector: passthroughPolicyTagListSelector});
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);

const {
options: listOptions,
Expand Down Expand Up @@ -111,6 +112,7 @@ function useOptions(reportAttributesDerived: ReportAttributesDerivedValue['repor
loginList,
currentUserAccountID,
currentUserEmail,
conciergeReportID,
{
betas: betas ?? [],
includeSelfDM: true,
Expand Down
3 changes: 3 additions & 0 deletions src/pages/iou/request/MoneyRequestAccountantSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ function MoneyRequestAccountantSelector({onFinish, onAccountantSelected, iouType
const currentUserEmail = currentUserPersonalDetails.email ?? '';
const currentUserAccountID = currentUserPersonalDetails.accountID;
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const privateIsArchivedMap = usePrivateIsArchivedMap();

useEffect(() => {
Expand All @@ -94,6 +95,7 @@ function MoneyRequestAccountantSelector({onFinish, onAccountantSelected, iouType
loginList,
currentUserAccountID,
currentUserEmail,
conciergeReportID,
{
betas,
excludeLogins: CONST.EXPENSIFY_EMAILS_OBJECT,
Expand Down Expand Up @@ -123,6 +125,7 @@ function MoneyRequestAccountantSelector({onFinish, onAccountantSelected, iouType
countryCode,
currentUserAccountID,
currentUserEmail,
conciergeReportID,
personalDetails,
]);

Expand Down
3 changes: 3 additions & 0 deletions tests/perf-test/OptionsListUtils.perf-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ describe('OptionsListUtils', () => {
loginList,
MOCK_CURRENT_USER_ACCOUNT_ID,
MOCK_CURRENT_USER_EMAIL,
undefined,
ValidOptionsConfig,
);
await measureFunction(() => {
Expand All @@ -172,6 +173,7 @@ describe('OptionsListUtils', () => {
loginList,
MOCK_CURRENT_USER_ACCOUNT_ID,
MOCK_CURRENT_USER_EMAIL,
undefined,
ValidOptionsConfig,
);
await measureFunction(() => {
Expand All @@ -191,6 +193,7 @@ describe('OptionsListUtils', () => {
loginList,
MOCK_CURRENT_USER_ACCOUNT_ID,
MOCK_CURRENT_USER_EMAIL,
undefined,
{
betas: mockedBetas,
includeMultipleParticipantReports: true,
Expand Down
Loading
Loading